# (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from .utils import compact_query

# https://clickhouse.yandex/docs/en/operations/system_tables/#system_tables-metrics
SystemMetrics = {
    'name': 'system.metrics',
    'query': 'SELECT value, metric FROM system.metrics',
    'columns': [
        {'name': 'value', 'type': 'source'},
        {
            'name': 'metric',
            'type': 'match',
            'source': 'value',
            'items': {
                'ActiveAsyncDrainedConnections': {'name': 'drained_connections.async.active', 'type': 'gauge'},
                'ActiveSyncDrainedConnections': {'name': 'drained_connections.sync.active', 'type': 'gauge'},
                'ActiveTimersInQueryProfiler': {'name': 'query.timers.active', 'type': 'gauge'},
                'AddressesActive': {'name': 'addresses.active', 'type': 'gauge'},
                'AggregatorThreads': {'name': 'aggregator.threads', 'type': 'gauge'},
                'AggregatorThreadsActive': {'name': 'aggregator.threads.active', 'type': 'gauge'},
                'AggregatorThreadsScheduled': {'name': 'aggregator.threads.scheduled', 'type': 'gauge'},
                'AsyncDrainedConnections': {'name': 'drained_connections.async', 'type': 'gauge'},
                'AsyncInsertCacheSize': {'name': 'cache.async.insert', 'type': 'gauge'},
                'AsynchronousInsertQueueBytes': {'name': 'insert_queue.async.size', 'type': 'gauge'},
                'AsynchronousInsertQueueSize': {'name': 'insert_queue.async.total', 'type': 'gauge'},
                'AsynchronousInsertThreads': {'name': 'insert_threads.async.total', 'type': 'gauge'},
                'AsynchronousInsertThreadsActive': {'name': 'insert_threads.async.active', 'type': 'gauge'},
                'AsynchronousInsertThreadsScheduled': {'name': 'insert_threads.async.scheduled', 'type': 'gauge'},
                'AsynchronousReadWait': {'name': 'threads.async.read', 'type': 'gauge'},
                'AttachedDatabase': {'name': 'attached.database', 'type': 'gauge'},
                'AttachedTable': {'name': 'attached.table', 'type': 'gauge'},
                'BackgroundBufferFlushSchedulePoolSize': {
                    'name': 'background_pool.buffer_flush_schedule.task.limit',
                    'type': 'gauge',
                },
                'BackgroundBufferFlushSchedulePoolTask': {
                    'name': 'background_pool.buffer_flush_schedule.task.active',
                    'type': 'gauge',
                },
                'BackgroundCommonPoolSize': {'name': 'background_pool.common.task.limit', 'type': 'gauge'},
                'BackgroundCommonPoolTask': {'name': 'background_pool.common.task.active', 'type': 'gauge'},
                'BackgroundDistributedSchedulePoolSize': {
                    'name': 'background_pool.distributed.task.limit',
                    'type': 'gauge',
                },
                'BackgroundDistributedSchedulePoolTask': {
                    'name': 'background_pool.distributed.task.active',
                    'type': 'gauge',
                },
                'BackgroundFetchesPoolSize': {'name': 'background_pool.fetches.task.limit', 'type': 'gauge'},
                'BackgroundFetchesPoolTask': {'name': 'background_pool.fetches.task.active', 'type': 'gauge'},
                'BackgroundMergesAndMutationsPoolSize': {'name': 'background_pool.merges.task.limit', 'type': 'gauge'},
                'BackgroundMergesAndMutationsPoolTask': {'name': 'background_pool.merges.task.active', 'type': 'gauge'},
                'BackgroundMessageBrokerSchedulePoolSize': {
                    'name': 'background_pool.message_broker.task.limit',
                    'type': 'gauge',
                },
                'BackgroundMessageBrokerSchedulePoolTask': {
                    'name': 'background_pool.message_broker.task.active',
                    'type': 'gauge',
                },
                'BackgroundMovePoolSize': {'name': 'background_pool.move.task.limit', 'type': 'gauge'},
                'BackgroundMovePoolTask': {'name': 'background_pool.move.task.active', 'type': 'gauge'},
                'BackgroundPoolTask': {'name': 'background_pool.processing.task.active', 'type': 'gauge'},
                'BackgroundSchedulePoolSize': {'name': 'background_pool.schedule.task.limit', 'type': 'gauge'},
                'BackgroundSchedulePoolTask': {'name': 'background_pool.schedule.task.active', 'type': 'gauge'},
                'BackupsIOThreads': {'name': 'backups_io.threads.total', 'type': 'gauge'},
                'BackupsIOThreadsActive': {'name': 'backups_io.threads.active', 'type': 'gauge'},
                'BackupsIOThreadsScheduled': {'name': 'backups_io.threads.scheduled', 'type': 'gauge'},
                'BackupsThreads': {'name': 'backups.threads.total', 'type': 'gauge'},
                'BackupsThreadsActive': {'name': 'backups.threads.active', 'type': 'gauge'},
                'BackupsThreadsScheduled': {'name': 'backups.threads.scheduled', 'type': 'gauge'},
                'BrokenDistributedBytesToInsert': {'name': 'table.distributed.bytes.insert.broken', 'type': 'gauge'},
                'BrokenDistributedFilesToInsert': {'name': 'table.distributed.file.insert.broken', 'type': 'gauge'},
                'CacheDetachedFileSegments': {'name': 'cache_file_segments.detached', 'type': 'gauge'},
                'CacheDictionaryThreads': {'name': 'cache_dictionary.threads.total', 'type': 'gauge'},
                'CacheDictionaryThreadsActive': {'name': 'cache_dictionary.threads.active', 'type': 'gauge'},
                'CacheDictionaryThreadsScheduled': {'name': 'cache_dictionary.threads.scheduled', 'type': 'gauge'},
                'CacheDictionaryUpdateQueueBatches': {'name': 'cache_dictionary.update_queue.batches', 'type': 'gauge'},
                'CacheDictionaryUpdateQueueKeys': {'name': 'cache_dictionary.update_queue.keys', 'type': 'gauge'},
                'CacheFileSegments': {'name': 'cache.file_segments', 'type': 'gauge'},
                'CacheWarmerBytesInProgress': {'name': 'cache.remote_file_segments.waiting', 'type': 'gauge'},
                'ContextLockWait': {'name': 'thread.lock.context.waiting', 'type': 'gauge'},
                'CreatedTimersInQueryProfiler': {'name': 'query.local_timers.active', 'type': 'gauge'},
                'DDLWorkerThreads': {'name': 'threads.ddl_worker.total', 'type': 'gauge'},
                'DDLWorkerThreadsActive': {'name': 'threads.ddl_worker.active', 'type': 'gauge'},
                'DDLWorkerThreadsScheduled': {'name': 'threads.ddl_worker.scheduled', 'type': 'gauge'},
                'DWARFReaderThreads': {'name': 'threads.dwarf.total', 'type': 'gauge'},
                'DWARFReaderThreadsActive': {'name': 'threads.dwarf.active', 'type': 'gauge'},
                'DWARFReaderThreadsScheduled': {'name': 'threads.dwarf.scheduled', 'type': 'gauge'},
                'DatabaseCatalogThreads': {'name': 'threads.database_catalog.total', 'type': 'gauge'},
                'DatabaseCatalogThreadsActive': {'name': 'threads.database_catalog.active', 'type': 'gauge'},
                'DatabaseCatalogThreadsScheduled': {'name': 'threads.database_catalog.scheduled', 'type': 'gauge'},
                'DatabaseOnDiskThreads': {'name': 'threads.database_ondisk.total', 'type': 'gauge'},
                'DatabaseOnDiskThreadsActive': {'name': 'threads.database_ondisk.active', 'type': 'gauge'},
                'DatabaseOnDiskThreadsScheduled': {'name': 'threads.database_ondisk.scheduled', 'type': 'gauge'},
                'DatabaseReplicatedCreateTablesThreads': {'name': 'threads.database_replicated.total', 'type': 'gauge'},
                'DatabaseReplicatedCreateTablesThreadsActive': {
                    'name': 'threads.database_replicated.active',
                    'type': 'gauge',
                },
                'DatabaseReplicatedCreateTablesThreadsScheduled': {
                    'name': 'threads.database_replicated.scheduled',
                    'type': 'gauge',
                },
                'DelayedInserts': {'name': 'query.insert.delayed', 'type': 'gauge'},
                'DestroyAggregatesThreads': {'name': 'threads.destroy_aggregates.total', 'type': 'gauge'},
                'DestroyAggregatesThreadsActive': {'name': 'threads.destroy_aggregates.active', 'type': 'gauge'},
                'DestroyAggregatesThreadsScheduled': {'name': 'threads.destroy_aggregates.scheduled', 'type': 'gauge'},
                'DictCacheRequests': {'name': 'dictionary.request.cache', 'type': 'gauge'},
                'DiskConnectionsStored': {'name': 'disk.connections.stored', 'type': 'gauge'},
                'DiskConnectionsTotal': {'name': 'disk.connectioned.active', 'type': 'gauge'},
                'DiskObjectStorageAsyncThreads': {'name': 'threads.async.disk_object_storage.total', 'type': 'gauge'},
                'DiskObjectStorageAsyncThreadsActive': {
                    'name': 'threads.async.disk_object_storage.active',
                    'type': 'gauge',
                },
                'DiskSpaceReservedForMerge': {'name': 'merge.disk.reserved', 'type': 'gauge'},
                'DistrCacheOpenedConnections': {'name': 'distributed_cache.connections.open.total', 'type': 'gauge'},
                'DistrCacheReadRequests': {'name': 'distributed_cache.read.requests', 'type': 'gauge'},
                'DistrCacheServerConnections': {
                    'name': 'distributed_cache.clickhouse_server.connections.open',
                    'type': 'gauge',
                },
                'DistrCacheUsedConnections': {'name': 'distributed_cache.connections.open.used', 'type': 'gauge'},
                'DistrCacheWriteRequests': {'name': 'distributed_cache.write.requests', 'type': 'gauge'},
                'DistributedBytesToInsert': {'name': 'table.distributed.bytes.insert.pending', 'type': 'gauge'},
                'DistributedFilesToInsert': {'name': 'table.distributed.file.insert.pending', 'type': 'gauge'},
                'DistributedInsertThreads': {'name': 'threads.distribured.insert.total', 'type': 'gauge'},
                'DistributedInsertThreadsActive': {'name': 'threads.distribured.insert.active', 'type': 'gauge'},
                'DistributedInsertThreadsScheduled': {'name': 'threads.distribured.insert.scheduled', 'type': 'gauge'},
                'DistributedSend': {'name': 'table.distributed.connection.inserted', 'type': 'gauge'},
                'EphemeralNode': {'name': 'zk.node.ephemeral', 'type': 'gauge'},
                'FilesystemCacheDelayedCleanupElements': {'name': 'filesystem.cache.cleanup.queue', 'type': 'gauge'},
                'FilesystemCacheDownloadQueueElements': {'name': 'filesystem.cache.download.queue', 'type': 'gauge'},
                'FilesystemCacheElements': {'name': 'filesystem.cache.elements', 'type': 'gauge'},
                'FilesystemCacheHoldFileSegments': {'name': 'filesystem.cache.filesegments.hold', 'type': 'gauge'},
                'FilesystemCacheReadBuffers': {'name': 'filesystem.cache.buffers.active', 'type': 'gauge'},
                'FilesystemCacheSize': {'name': 'filesystem.cache.size', 'type': 'gauge'},
                'FilesystemCacheSizeLimit': {'name': 'filesystem.cache.limit', 'type': 'gauge'},
                'GlobalThread': {'name': 'thread.global.total', 'type': 'gauge'},
                'GlobalThreadActive': {'name': 'thread.global.active', 'type': 'gauge'},
                'GlobalThreadScheduled': {'name': 'thread.global.scheduled', 'type': 'gauge'},
                'HTTPConnection': {'name': 'connection.http', 'type': 'gauge'},
                'HTTPConnectionsStored': {'name': 'connection.http.stored', 'type': 'gauge'},
                'HTTPConnectionsTotal': {'name': 'connection.http.total', 'type': 'gauge'},
                'HashedDictionaryThreads': {'name': 'threads.hashed_dictionary.total', 'type': 'gauge'},
                'HashedDictionaryThreadsActive': {'name': 'threads.hashed_dictionary.active', 'type': 'gauge'},
                'HashedDictionaryThreadsScheduled': {'name': 'threads.hashed_dictionary.scheduled', 'type': 'gauge'},
                'IDiskCopierThreads': {'name': 'threads.idisk.copier.total', 'type': 'gauge'},
                'IDiskCopierThreadsActive': {'name': 'threads.idisk.copier.active', 'type': 'gauge'},
                'IDiskCopierThreadsScheduled': {'name': 'threads.idisk.copier.scheduled', 'type': 'gauge'},
                'IOPrefetchThreads': {'name': 'threads.io_prefetch.total', 'type': 'gauge'},
                'IOPrefetchThreadsActive': {'name': 'threads.io_prefetch.active', 'type': 'gauge'},
                'IOPrefetchThreadsScheduled': {'name': 'threads.io_prefetch.scheduled', 'type': 'gauge'},
                'IOThreads': {'name': 'threads.io.total', 'type': 'gauge'},
                'IOThreadsActive': {'name': 'threads.io.active', 'type': 'gauge'},
                'IOThreadsScheduled': {'name': 'threads.io.scheduled', 'type': 'gauge'},
                'IOUringInFlightEvents': {'name': 'sqe.io_uring.inflight', 'type': 'gauge'},
                'IOUringPendingEvents': {'name': 'sqe.io_uring.waiting', 'type': 'gauge'},
                'IOWriterThreads': {'name': 'threads.io_writer.total', 'type': 'gauge'},
                'IOWriterThreadsActive': {'name': 'threads.io_writer.active', 'type': 'gauge'},
                'IOWriterThreadsScheduled': {'name': 'threads.io_writer.scheduled', 'type': 'gauge'},
                'InterserverConnection': {'name': 'connection.interserver', 'type': 'gauge'},
                'KafkaAssignedPartitions': {'name': 'kafka.partitions.assigned', 'type': 'gauge'},
                'KafkaBackgroundReads': {'name': 'kafka.background.reads', 'type': 'gauge'},
                'KafkaConsumers': {'name': 'kafka.consumers.active', 'type': 'gauge'},
                'KafkaConsumersInUse': {'name': 'kafka.consumers.in_use', 'type': 'gauge'},
                'KafkaConsumersWithAssignment': {'name': 'kafka.consumers.assigned', 'type': 'gauge'},
                'KafkaLibrdkafkaThreads': {'name': 'threads.librdkafka.active', 'type': 'gauge'},
                'KafkaProducers': {'name': 'kafka.producers.active', 'type': 'gauge'},
                'KafkaWrites': {'name': 'kafka.inserts.running', 'type': 'gauge'},
                'KeeperAliveConnections': {'name': 'connections.alive.total', 'type': 'gauge'},
                'KeeperOutstandingRequets': {'name': 'connections.outstanding.total', 'type': 'gauge'},
                'LeaderElection': {'name': 'replica.leader.election', 'type': 'gauge'},
                'LeaderReplica': {'name': 'table.replicated.leader', 'type': 'gauge'},
                'LocalThread': {'name': 'thread.local.total', 'type': 'gauge'},
                'LocalThreadActive': {'name': 'thread.local.active', 'type': 'gauge'},
                'LocalThreadScheduled': {'name': 'thread.local.scheduled', 'type': 'gauge'},
                'MMappedFileBytes': {'name': 'mmapped.file.size', 'type': 'gauge'},
                'MMappedFiles': {'name': 'mmapped.file.current', 'type': 'gauge'},
                'MarksLoaderThreads': {'name': 'threads.marks_loader.total', 'type': 'gauge'},
                'MarksLoaderThreadsActive': {'name': 'threads.marks_loader.active', 'type': 'gauge'},
                'MarksLoaderThreadsScheduled': {'name': 'threads.marks_loader.scheduled', 'type': 'gauge'},
                'MaxDDLEntryID': {'name': 'ddl.max_processed', 'type': 'gauge'},
                'MaxPushedDDLEntryID': {'name': 'zk.ddl_entry.max', 'type': 'gauge'},
                'MemoryTracking': {'name': 'query.memory', 'type': 'gauge'},
                'MemoryTrackingForMerges': {'name': 'merge.memory', 'type': 'gauge'},
                'MemoryTrackingInBackgroundMoveProcessingPool': {
                    'name': 'background_pool.move.memory',
                    'type': 'gauge',
                },
                'MemoryTrackingInBackgroundProcessingPool': {
                    'name': 'background_pool.processing.memory',
                    'type': 'gauge',
                },
                'MemoryTrackingInBackgroundSchedulePool': {'name': 'background_pool.schedule.memory', 'type': 'gauge'},
                'Merge': {'name': 'merge.active', 'type': 'gauge'},
                'MergeTreeAllRangesAnnouncementsSent': {'name': 'merge_tree.announcements.sent', 'type': 'gauge'},
                'MergeTreeBackgroundExecutorThreads': {
                    'name': 'threads.merge_tree_background_executor.total',
                    'type': 'gauge',
                },
                'MergeTreeBackgroundExecutorThreadsActive': {
                    'name': 'threads.merge_tree_background_executor.active',
                    'type': 'gauge',
                },
                'MergeTreeBackgroundExecutorThreadsScheduled': {
                    'name': 'threads.merge_tree_background_executor.scheduled',
                    'type': 'gauge',
                },
                'MergeTreeDataSelectExecutorThreads': {
                    'name': 'threads.merge_tree_data_selector_executor.total',
                    'type': 'gauge',
                },
                'MergeTreeDataSelectExecutorThreadsActive': {
                    'name': 'threads.merge_tree_data_selector_executor.active',
                    'type': 'gauge',
                },
                'MergeTreeDataSelectExecutorThreadsScheduled': {
                    'name': 'threads.merge_tree_data_selector_executor.scheduled',
                    'type': 'gauge',
                },
                'MergeTreeOutdatedPartsLoaderThreads': {
                    'name': 'threads.merge_tree_outdated_parts_loader.total',
                    'type': 'gauge',
                },
                'MergeTreeOutdatedPartsLoaderThreadsActive': {
                    'name': 'threads.merge_tree_outdated_parts_loader.active',
                    'type': 'gauge',
                },
                'MergeTreeOutdatedPartsLoaderThreadsScheduled': {
                    'name': 'threads.merge_tree_outdated_parts_loader.scheduled',
                    'type': 'gauge',
                },
                'MergeTreePartsCleanerThreads': {'name': 'threads.merge_tree_parts_cleaner.total', 'type': 'gauge'},
                'MergeTreePartsCleanerThreadsActive': {
                    'name': 'threads.merge_tree_parts_cleaner.active',
                    'type': 'gauge',
                },
                'MergeTreePartsCleanerThreadsScheduled': {
                    'name': 'threads.merge_tree_parts_cleaner.scheduled',
                    'type': 'gauge',
                },
                'MergeTreePartsLoaderThreads': {'name': 'threads.merge_tree_parts_loader.total', 'type': 'gauge'},
                'MergeTreePartsLoaderThreadsActive': {
                    'name': 'threads.merge_tree_parts_loader.active',
                    'type': 'gauge',
                },
                'MergeTreePartsLoaderThreadsScheduled': {
                    'name': 'threads.merge_tree_parts_loader.scheduled',
                    'type': 'gauge',
                },
                'MergeTreeReadTaskRequestsSent': {'name': 'merge_tree.read_task.requests.sent', 'type': 'gauge'},
                'MergesMutationsMemoryTracking': {'name': 'merges_mutations.bytes.total', 'type': 'gauge'},
                'Move': {'name': 'moves.executing.currently', 'type': 'gauge'},
                'MySQLConnection': {'name': 'connection.mysql', 'type': 'gauge'},
                'NetworkReceive': {'name': 'network.threads.receive', 'type': 'gauge'},
                'NetworkSend': {'name': 'network.threads.send', 'type': 'gauge'},
                'ObjectStorageAzureThreads': {'name': 'threads.azure_object_storage.total', 'type': 'gauge'},
                'ObjectStorageAzureThreadsActive': {'name': 'threads.azure_object_storage.active', 'type': 'gauge'},
                'ObjectStorageAzureThreadsScheduled': {
                    'name': 'threads.azure_object_storage.scheduled',
                    'type': 'gauge',
                },
                'ObjectStorageS3Threads': {'name': 'threads.s3_object_storage.total', 'type': 'gauge'},
                'ObjectStorageS3ThreadsActive': {'name': 'threads.s3_object_storage.active', 'type': 'gauge'},
                'ObjectStorageS3ThreadsScheduled': {'name': 'threads.s3_object_storage.scheduled', 'type': 'gauge'},
                'OpenFileForRead': {'name': 'file.open.read', 'type': 'gauge'},
                'OpenFileForWrite': {'name': 'file.open.write', 'type': 'gauge'},
                'OutdatedPartsLoadingThreads': {'name': 'threads.outdated_parts_loading.total', 'type': 'gauge'},
                'OutdatedPartsLoadingThreadsActive': {'name': 'threads.outdated_parts_loading.active', 'type': 'gauge'},
                'OutdatedPartsLoadingThreadsScheduled': {
                    'name': 'threads.outdated_parts_loading.scheduled',
                    'type': 'gauge',
                },
                'ParallelFormattingOutputFormatThreads': {
                    'name': 'threads.parallel_formatting_output.total',
                    'type': 'gauge',
                },
                'ParallelFormattingOutputFormatThreadsActive': {
                    'name': 'threads.parallel_formatting_output.active',
                    'type': 'gauge',
                },
                'ParallelFormattingOutputFormatThreadsScheduled': {
                    'name': 'threads.parallel_formatting_output.scheduled',
                    'type': 'gauge',
                },
                'ParallelParsingInputFormatThreads': {'name': 'threads.parallel_parsing_input.total', 'type': 'gauge'},
                'ParallelParsingInputFormatThreadsActive': {
                    'name': 'threads.parallel_parsing_input.active',
                    'type': 'gauge',
                },
                'ParallelParsingInputFormatThreadsScheduled': {
                    'name': 'threads.parallel_parsing_input.scheduled',
                    'type': 'gauge',
                },
                'ParquetDecoderThreads': {'name': 'threads.parquet_decoder.total', 'type': 'gauge'},
                'ParquetDecoderThreadsActive': {'name': 'threads.parquet_decoder.active', 'type': 'gauge'},
                'ParquetDecoderThreadsScheduled': {'name': 'threads.parquet_decoder.scheduled', 'type': 'gauge'},
                'ParquetEncoderThreads': {'name': 'threads.parquet_encoder.total', 'type': 'gauge'},
                'ParquetEncoderThreadsActive': {'name': 'threads.parquet_encoder.active', 'type': 'gauge'},
                'ParquetEncoderThreadsScheduled': {'name': 'threads.parquet_encoder.scheduled', 'type': 'gauge'},
                'PartMutation': {'name': 'query.mutation', 'type': 'gauge'},
                'PartsActive': {'name': 'parts.active', 'type': 'gauge'},
                'PartsCommitted': {'name': 'parts.committed', 'type': 'gauge'},
                'PartsCompact': {'name': 'parts.compact', 'type': 'gauge'},
                'PartsDeleteOnDestroy': {'name': 'parts.delete_on_destroy', 'type': 'gauge'},
                'PartsDeleting': {'name': 'parts.deleting', 'type': 'gauge'},
                'PartsInMemory': {'name': 'parts.inmemory', 'type': 'gauge'},
                'PartsOutdated': {'name': 'parts.outdated', 'type': 'gauge'},
                'PartsPreActive': {'name': 'parts.pre_active', 'type': 'gauge'},
                'PartsPreCommitted': {'name': 'parts.precommitted', 'type': 'gauge'},
                'PartsTemporary': {'name': 'parts.temporary', 'type': 'gauge'},
                'PartsWide': {'name': 'parts.wide', 'type': 'gauge'},
                'PendingAsyncInsert': {'name': 'inserts.async.flush.pending', 'type': 'gauge'},
                'PostgreSQLConnection': {'name': 'postgresql.connection', 'type': 'gauge'},
                'Query': {'name': 'query.active', 'type': 'gauge'},
                'QueryPipelineExecutorThreads': {'name': 'threads.query_pipeline_executor.total', 'type': 'gauge'},
                'QueryPipelineExecutorThreadsActive': {
                    'name': 'threads.query_pipeline_executor.active',
                    'type': 'gauge',
                },
                'QueryPipelineExecutorThreadsScheduled': {
                    'name': 'threads.query_pipeline_executor.scheduled',
                    'type': 'gauge',
                },
                'QueryPreempted': {'name': 'query.waiting', 'type': 'gauge'},
                'QueryThread': {'name': 'thread.query', 'type': 'gauge'},
                'RWLockActiveReaders': {'name': 'thread.lock.rw.active.read', 'type': 'gauge'},
                'RWLockActiveWriters': {'name': 'thread.lock.rw.active.write', 'type': 'gauge'},
                'RWLockWaitingReaders': {'name': 'thread.lock.rw.waiting.read', 'type': 'gauge'},
                'RWLockWaitingWriters': {'name': 'thread.lock.rw.waiting.write', 'type': 'gauge'},
                'Read': {'name': 'syscall.read', 'type': 'gauge'},
                'ReadTaskRequestsSent': {'name': 'task.requests.callback', 'type': 'gauge'},
                'ReadonlyReplica': {'name': 'table.replicated.readonly', 'type': 'gauge'},
                'RefreshableViews': {'name': 'views.refreshing.total', 'type': 'gauge'},
                'RefreshingViews': {'name': 'views.refreshing.current', 'type': 'gauge'},
                'RemoteRead': {'name': 'remote_reader.total', 'type': 'gauge'},
                'ReplicatedChecks': {'name': 'table.replicated.part.check', 'type': 'gauge'},
                'ReplicatedFetch': {'name': 'table.replicated.part.fetch', 'type': 'gauge'},
                'ReplicatedSend': {'name': 'table.replicated.part.send', 'type': 'gauge'},
                'RestartReplicaThreads': {'name': 'threads.restart_replica.active', 'type': 'gauge'},
                'RestartReplicaThreadsActive': {'name': 'threads.restart_replica.active', 'type': 'gauge'},
                'RestartReplicaThreadsScheduled': {'name': 'threads.restart_replica.scheduled', 'type': 'gauge'},
                'RestoreThreads': {'name': 'threads.restore.total', 'type': 'gauge'},
                'RestoreThreadsActive': {'name': 'threads.restore.active', 'type': 'gauge'},
                'RestoreThreadsScheduled': {'name': 'threads.restore.scheduled', 'type': 'gauge'},
                'S3Requests': {'name': 's3.requests.count', 'type': 'gauge'},
                'SendExternalTables': {'name': 'connection.send.external', 'type': 'gauge'},
                'SendScalars': {'name': 'connection.send.scalar', 'type': 'gauge'},
                'SharedMergeTreeFetch': {'name': 'shared_merge_tree.fetches.total', 'type': 'gauge'},
                'SharedMergeTreeThreads': {'name': 'threads.shared_merge_tree.total', 'type': 'gauge'},
                'SharedMergeTreeThreadsActive': {'name': 'threads.shared_merge_tree.active', 'type': 'gauge'},
                'SharedMergeTreeThreadsScheduled': {'name': 'threads.shared_merge_tree.scheduled', 'type': 'gauge'},
                'StartupSystemTablesThreads': {'name': 'threads.startup_system_tables.total', 'type': 'gauge'},
                'StartupSystemTablesThreadsActive': {'name': 'threads.startup_system_tables.active', 'type': 'gauge'},
                'StartupSystemTablesThreadsScheduled': {
                    'name': 'threads.startup_system_tables.scheduled',
                    'type': 'gauge',
                },
                'StorageBufferBytes': {'name': 'table.buffer.size', 'type': 'gauge'},
                'StorageBufferFlushThreads': {'name': 'threads.storage_buffer_flush.total', 'type': 'gauge'},
                'StorageBufferFlushThreadsActive': {'name': 'threads.storage_buffer_flush.active', 'type': 'gauge'},
                'StorageBufferFlushThreadsScheduled': {
                    'name': 'threads.storage_buffer_flush.scheduled',
                    'type': 'gauge',
                },
                'StorageBufferRows': {'name': 'table.buffer.row', 'type': 'gauge'},
                'StorageConnectionsStored': {'name': 'sessions_pool.storage.total', 'type': 'gauge'},
                'StorageConnectionsTotal': {'name': 'sessions_pool.storage.active', 'type': 'gauge'},
                'StorageDistributedThreads': {'name': 'threads.storage_distributed.total', 'type': 'gauge'},
                'StorageDistributedThreadsActive': {'name': 'threads.storage_distributed.active', 'type': 'gauge'},
                'StorageDistributedThreadsScheduled': {
                    'name': 'threads.storage_distributed.scheduled',
                    'type': 'gauge',
                },
                'StorageHiveThreads': {'name': 'threads.storage_hive.total', 'type': 'gauge'},
                'StorageHiveThreadsActive': {'name': 'threads.storage_hive.active', 'type': 'gauge'},
                'StorageHiveThreadsScheduled': {'name': 'threads.storage_hive.scheduled', 'type': 'gauge'},
                'StorageS3Threads': {'name': 'threads.storage_s3.total', 'type': 'gauge'},
                'StorageS3ThreadsActive': {'name': 'threads.storage_s3.active', 'type': 'gauge'},
                'StorageS3ThreadsScheduled': {'name': 'threads.storage_s3.scheduled', 'type': 'gauge'},
                'SyncDrainedConnections': {'name': 'drained_connections.sync', 'type': 'gauge'},
                'SystemReplicasThreads': {'name': 'threads.system_replicas.total', 'type': 'gauge'},
                'SystemReplicasThreadsActive': {'name': 'threads.system_replicas.active', 'type': 'gauge'},
                'SystemReplicasThreadsScheduled': {'name': 'threads.system_replicas.scheduled', 'type': 'gauge'},
                'TCPConnection': {'name': 'connection.tcp', 'type': 'gauge'},
                'TablesLoaderBackgroundThreads': {'name': 'threads.tables_loader_background.total', 'type': 'gauge'},
                'TablesLoaderBackgroundThreadsActive': {
                    'name': 'threads.tables_loader_background.active',
                    'type': 'gauge',
                },
                'TablesLoaderBackgroundThreadsScheduled': {
                    'name': 'threads.tables_loader_background.scheduled',
                    'type': 'gauge',
                },
                'TablesLoaderForegroundThreads': {'name': 'threads.tables_loader_foreground.total', 'type': 'gauge'},
                'TablesLoaderForegroundThreadsActive': {
                    'name': 'threads.tables_loader_foreground.active',
                    'type': 'gauge',
                },
                'TablesLoaderForegroundThreadsScheduled': {
                    'name': 'threads.tables_loader_foreground.scheduled',
                    'type': 'gauge',
                },
                'TablesToDropQueueSize': {'name': 'tables_to_drop.queue.total', 'type': 'gauge'},
                'TemporaryFilesForAggregation': {'name': 'temporary_files.aggregation.total', 'type': 'gauge'},
                'TemporaryFilesForJoin': {'name': 'temporary_files.join.total', 'type': 'gauge'},
                'TemporaryFilesForSort': {'name': 'temporary_files.sort.total', 'type': 'gauge'},
                'TemporaryFilesUnknown': {'name': 'temporary_files.unknown.total', 'type': 'gauge'},
                'ThreadPoolFSReaderThreads': {'name': 'threads.pool.fs_reader.total', 'type': 'gauge'},
                'ThreadPoolFSReaderThreadsActive': {'name': 'threads.pool.fs_reader.active', 'type': 'gauge'},
                'ThreadPoolFSReaderThreadsScheduled': {'name': 'threads.pool.fs_reader.scheduled', 'type': 'gauge'},
                'ThreadPoolRemoteFSReaderThreads': {'name': 'threads.pool.remote_fs_reader.total', 'type': 'gauge'},
                'ThreadPoolRemoteFSReaderThreadsActive': {
                    'name': 'threads.pool.remote_fs_reader.active',
                    'type': 'gauge',
                },
                'ThreadPoolRemoteFSReaderThreadsScheduled': {
                    'name': 'threads.pool.remote_fs_reader.scheduled',
                    'type': 'gauge',
                },
                'ThreadsInOvercommitTracker': {'name': 'threads.in_overcommit_tracker.total', 'type': 'gauge'},
                'TotalTemporaryFiles': {'name': 'temporary_files.total', 'type': 'gauge'},
                'Write': {'name': 'syscall.write', 'type': 'gauge'},
                'ZooKeeperRequest': {'name': 'zk.request', 'type': 'gauge'},
                'ZooKeeperSession': {'name': 'zk.connection', 'type': 'gauge'},
                'ZooKeeperWatch': {'name': 'zk.watch', 'type': 'gauge'},
            },
        },
    ],
}


# https://clickhouse.yandex/docs/en/operations/system_tables/#system_tables-events
SystemEvents = {
    'name': 'system.events',
    'query': 'SELECT value, event FROM system.events',
    'columns': [
        {'name': 'value', 'type': 'source'},
        {
            'name': 'event',
            'type': 'match',
            'source': 'value',
            'items': {
                'AIORead': {'name': 'aio.read', 'type': 'monotonic_gauge'},
                'AIOReadBytes': {'name': 'aio.read.size', 'type': 'monotonic_gauge'},
                'AIOWrite': {'name': 'aio.write', 'type': 'monotonic_gauge'},
                'AIOWriteBytes': {'name': 'aio.write.size', 'type': 'monotonic_gauge'},
                'AddressesDiscovered': {'name': 'http_connection.addresses.new', 'type': 'monotonic_gauge'},
                'AddressesExpired': {'name': 'http_connection.addresses.expired', 'type': 'monotonic_gauge'},
                'AddressesMarkedAsFailed': {'name': 'http_connection.addresses.faulty', 'type': 'monotonic_gauge'},
                'AggregationHashTablesInitializedAsTwoLevel': {
                    'name': 'hash_table.initialized.aggregation.two_level',
                    'type': 'monotonic_gauge',
                },
                'AggregationOptimizedEqualRangesOfKeys': {
                    'name': 'blocks.optimization.equal',
                    'type': 'monotonic_gauge',
                },
                'AggregationPreallocatedElementsInHashTables': {
                    'name': 'hash_table.elements.allocated.aggregation',
                    'type': 'monotonic_gauge',
                },
                'ArenaAllocBytes': {'name': 'memory.arena.bytes', 'type': 'monotonic_gauge'},
                'ArenaAllocChunks': {'name': 'memory.arena.chunks', 'type': 'monotonic_gauge'},
                'AsyncInsertBytes': {'name': 'query.async.insert.bytes', 'type': 'monotonic_gauge'},
                'AsyncInsertCacheHits': {'name': 'query.async.insert.hash_id.duplicate', 'type': 'monotonic_gauge'},
                'AsyncInsertQuery': {'name': 'query.async.insert', 'type': 'monotonic_gauge'},
                'AsyncInsertRows': {'name': 'query.async.insert.rows', 'type': 'monotonic_gauge'},
                'AsyncLoaderWaitMicroseconds': {
                    'name': 'query.async.loader.wait.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'AsynchronousReadWaitMicroseconds': {
                    'name': 'async.read.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'AsynchronousReaderIgnoredBytes': {'name': 'async.reader.ignored.bytes', 'type': 'monotonic_gauge'},
                'AsynchronousRemoteReadWaitMicroseconds': {
                    'name': 'async.remote_read.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'AzureCopyObject': {'name': 'azure.blob_storage.copy_object', 'type': 'monotonic_gauge'},
                'AzureDeleteObjects': {'name': 'azure.blob_storage.delete_object', 'type': 'monotonic_gauge'},
                'AzureListObjects': {'name': 'azure.blob_storage.list_object', 'type': 'monotonic_gauge'},
                'AzureUploadPart': {'name': 'azure.blob_storage.upload_part', 'type': 'monotonic_gauge'},
                'BackgroundLoadingMarksTasks': {'name': 'tasks.background.loading_marks', 'type': 'monotonic_gauge'},
                'BackupEntriesCollectorForTablesDataMicroseconds': {
                    'name': 'backup.tables.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'BackupEntriesCollectorMicroseconds': {
                    'name': 'backup.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'BackupEntriesCollectorRunPostTasksMicroseconds': {
                    'name': 'backup.post_tasks.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'BackupReadMetadataMicroseconds': {
                    'name': 'backup.read.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'BackupWriteMetadataMicroseconds': {
                    'name': 'backup.write.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'BackupsOpenedForRead': {'name': 'backups.read.open', 'type': 'monotonic_gauge'},
                'BackupsOpenedForWrite': {'name': 'backups.write.open', 'type': 'monotonic_gauge'},
                'CacheWarmerBytesDownloaded': {'name': 'cachewarmer.bytes.downloaded', 'type': 'monotonic_gauge'},
                'CacheWarmerDataPartsDownloaded': {
                    'name': 'cachewarmer.data_parts.downloaded',
                    'type': 'monotonic_gauge',
                },
                'CachedReadBufferCacheWriteBytes': {'name': 'cache.source.write.bytes', 'type': 'monotonic_gauge'},
                'CachedReadBufferCacheWriteMicroseconds': {
                    'name': 'cache.source.write.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'CachedReadBufferCreateBufferMicroseconds': {
                    'name': 'cache.buffer.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'CachedReadBufferReadFromCacheBytes': {'name': 'cache.read.bytes', 'type': 'monotonic_gauge'},
                'CachedReadBufferReadFromCacheHits': {'name': 'cache.read.hits', 'type': 'monotonic_gauge'},
                'CachedReadBufferReadFromCacheMicroseconds': {
                    'name': 'cache.read.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'CachedReadBufferReadFromCacheMisses': {'name': 'cache.read.misses', 'type': 'monotonic_gauge'},
                'CachedReadBufferReadFromSourceBytes': {'name': 'cache.source.read.bytes', 'type': 'monotonic_gauge'},
                'CachedReadBufferReadFromSourceMicroseconds': {
                    'name': 'cache.source.read.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'CachedWriteBufferCacheWriteBytes': {'name': 'cache.write.bytes', 'type': 'monotonic_gauge'},
                'CachedWriteBufferCacheWriteMicroseconds': {
                    'name': 'cache.write.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'CannotRemoveEphemeralNode': {'name': 'node.remove', 'type': 'monotonic_gauge'},
                'CannotWriteToWriteBufferDiscard': {'name': 'buffer.write.discard', 'type': 'monotonic_gauge'},
                'CompileAttempt': {'name': 'compilation.attempt', 'type': 'monotonic_gauge'},
                'CompileExpressionsBytes': {'name': 'compilation.size', 'type': 'monotonic_gauge'},
                'CompileExpressionsMicroseconds': {
                    'name': 'compilation.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'CompileFunction': {'name': 'compilation.llvm.attempt', 'type': 'monotonic_gauge'},
                'CompileSuccess': {'name': 'compilation.success', 'type': 'monotonic_gauge'},
                'CompiledFunctionExecute': {'name': 'compilation.function.execute', 'type': 'monotonic_gauge'},
                'CompressedReadBufferBlocks': {'name': 'read.compressed.block', 'type': 'monotonic_gauge'},
                'CompressedReadBufferBytes': {'name': 'read.compressed.raw.size', 'type': 'monotonic_gauge'},
                'ConnectionPoolIsFullMicroseconds': {
                    'name': 'pool.connection.slot.wait_time',
                    'type': 'monotonic_gauge',
                },
                'ContextLock': {'name': 'lock.context.acquisition', 'type': 'monotonic_gauge'},
                'ContextLockWaitMicroseconds': {'name': 'lock.context.wait_time', 'type': 'monotonic_gauge'},
                'CreatedHTTPConnections': {'name': 'connection.http.create', 'type': 'monotonic_gauge'},
                'CreatedLogEntryForMerge': {'name': 'log.entry.merge.created', 'type': 'monotonic_gauge'},
                'CreatedLogEntryForMutation': {'name': 'log.entry.mutation.created', 'type': 'monotonic_gauge'},
                'CreatedReadBufferDirectIO': {'name': 'read.buffer.o_direct.created', 'type': 'monotonic_gauge'},
                'CreatedReadBufferDirectIOFailed': {'name': 'read.buffer.o_direct.failed', 'type': 'monotonic_gauge'},
                'CreatedReadBufferMMap': {'name': 'read.buffer.mmap.created', 'type': 'monotonic_gauge'},
                'CreatedReadBufferMMapFailed': {'name': 'read.buffer.mmap.failed', 'type': 'monotonic_gauge'},
                'CreatedReadBufferOrdinary': {'name': 'read.buffer.ordinary.created', 'type': 'monotonic_gauge'},
                'DNSError': {'name': 'error.dns', 'type': 'monotonic_gauge'},
                'DataAfterMutationDiffersFromReplica': {
                    'name': 'mutated_data.not_equal.replica.num',
                    'type': 'monotonic_gauge',
                },
                'DelayedInserts': {'name': 'table.mergetree.insert.delayed', 'type': 'monotonic_gauge'},
                'DelayedInsertsMilliseconds': {
                    'name': 'table.mergetree.insert.delayed.time',
                    'type': 'temporal_percent',
                    'scale': 'millisecond',
                },
                'DelayedMutations': {'name': 'table.mergetree.mutation.delayed', 'type': 'monotonic_gauge'},
                'DelayedMutationsMilliseconds': {
                    'name': 'table.mergetree.insert.mutation.time',
                    'type': 'temporal_percent',
                    'scale': 'millisecond',
                },
                'DictCacheKeysExpired': {'name': 'dictionary.cache.keys.expired', 'type': 'monotonic_gauge'},
                'DictCacheKeysHit': {'name': 'dictionary.cache.keys.found', 'type': 'monotonic_gauge'},
                'DictCacheKeysNotFound': {'name': 'dictionary.cache.keys.not_found', 'type': 'monotonic_gauge'},
                'DictCacheKeysRequested': {'name': 'dictionary.cache.keys.requested', 'type': 'monotonic_gauge'},
                'DictCacheKeysRequestedFound': {
                    'name': 'dictionary.cache.keys.requested.found',
                    'type': 'monotonic_gauge',
                },
                'DictCacheKeysRequestedMiss': {
                    'name': 'dictionary.cache.keys.requested.missed',
                    'type': 'monotonic_gauge',
                },
                'DictCacheLockReadNs': {
                    'name': 'dictionary.cache.read.waiting.time',
                    'type': 'temporal_percent',
                    'scale': 'nanosecond',
                },
                'DictCacheLockWriteNs': {
                    'name': 'dictionary.cache.write.waiting.time',
                    'type': 'temporal_percent',
                    'scale': 'nanosecond',
                },
                'DictCacheRequestTimeNs': {
                    'name': 'dictionary.cache.request.time',
                    'type': 'temporal_percent',
                    'scale': 'nanosecond',
                },
                'DictCacheRequests': {'name': 'dictionary.cache.requests', 'type': 'monotonic_gauge'},
                'DirectorySync': {'name': 'syscall.directory.sync', 'type': 'monotonic_gauge'},
                'DirectorySyncElapsedMicroseconds': {
                    'name': 'syscall.directory.sync.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DiskAzureCopyObject': {'name': 'disk.azure.copy_object', 'type': 'monotonic_gauge'},
                'DiskAzureUploadPart': {'name': 'disk.azure.upload_part', 'type': 'monotonic_gauge'},
                'DiskConnectionsCreated': {'name': 'disk.connections.created', 'type': 'monotonic_gauge'},
                'DiskConnectionsElapsedMicroseconds': {
                    'name': 'disk.connections.created.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DiskConnectionsErrors': {'name': 'disk.connections.errors', 'type': 'monotonic_gauge'},
                'DiskConnectionsExpired': {'name': 'disk.connections.expired', 'type': 'monotonic_gauge'},
                'DiskConnectionsPreserved': {'name': 'disk.connections.preserved', 'type': 'monotonic_gauge'},
                'DiskConnectionsReset': {'name': 'disk.connections.reset', 'type': 'monotonic_gauge'},
                'DiskConnectionsReused': {'name': 'disk.connections.reused', 'type': 'monotonic_gauge'},
                'DiskReadElapsedMicroseconds': {
                    'name': 'syscall.read.wait',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DiskS3AbortMultipartUpload': {'name': 'disk_s3.abort_multipart_upload', 'type': 'monotonic_gauge'},
                'DiskS3CompleteMultipartUpload': {
                    'name': 'disk_s3.complete_multipart_upload',
                    'type': 'monotonic_gauge',
                },
                'DiskS3CopyObject': {'name': 'disk_s3.copy_object', 'type': 'monotonic_gauge'},
                'DiskS3CreateMultipartUpload': {'name': 'disk_s3.create_multipart_upload', 'type': 'monotonic_gauge'},
                'DiskS3DeleteObjects': {'name': 'disk_s3.delete_object', 'type': 'monotonic_gauge'},
                'DiskS3GetObject': {'name': 'disk_s3.get_object', 'type': 'monotonic_gauge'},
                'DiskS3GetObjectAttributes': {'name': 'disk_s3.get_object_attributes', 'type': 'monotonic_gauge'},
                'DiskS3GetRequestThrottlerCount': {
                    'name': 'disk_s3.get_request.throttler.count',
                    'type': 'monotonic_gauge',
                },
                'DiskS3GetRequestThrottlerSleepMicroseconds': {
                    'name': 'disk_s3.get_request.throttler.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DiskS3HeadObject': {'name': 'disk_s3.head_objects', 'type': 'monotonic_gauge'},
                'DiskS3ListObjects': {'name': 'disk_s3.list_objects', 'type': 'monotonic_gauge'},
                'DiskS3PutObject': {'name': 'disk_s3.put_object', 'type': 'monotonic_gauge'},
                'DiskS3PutRequestThrottlerCount': {
                    'name': 'disk_s3.put_request.throttler.count',
                    'type': 'monotonic_gauge',
                },
                'DiskS3PutRequestThrottlerSleepMicroseconds': {
                    'name': 'disk_s3.put_request.throttler.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DiskS3ReadMicroseconds': {
                    'name': 'disk_s3.read.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DiskS3ReadRequestsCount': {'name': 'disk_s3.read.requests', 'type': 'monotonic_gauge'},
                'DiskS3ReadRequestsErrors': {'name': 'disk_s3.read.requests.errors', 'type': 'monotonic_gauge'},
                'DiskS3ReadRequestsRedirects': {'name': 'disk_s3.read.requests.redirects', 'type': 'monotonic_gauge'},
                'DiskS3ReadRequestsThrottling': {'name': 'disk_s3.read.requests.throttling', 'type': 'monotonic_gauge'},
                'DiskS3UploadPart': {'name': 'disk_s3.upload_part', 'type': 'monotonic_gauge'},
                'DiskS3UploadPartCopy': {'name': 'disk_s3.upload_part_copy', 'type': 'monotonic_gauge'},
                'DiskS3WriteMicroseconds': {
                    'name': 'disk_s3.write.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DiskS3WriteRequestsCount': {'name': 'disk_s3.write.requests', 'type': 'monotonic_gauge'},
                'DiskS3WriteRequestsErrors': {'name': 'disk_s3.write.requests.errors', 'type': 'monotonic_gauge'},
                'DiskS3WriteRequestsRedirects': {'name': 'disk_s3.write.requests.redirects', 'type': 'monotonic_gauge'},
                'DiskS3WriteRequestsThrottling': {
                    'name': 'disk_s3.write.requests.throttling',
                    'type': 'monotonic_gauge',
                },
                'DiskWriteElapsedMicroseconds': {
                    'name': 'syscall.write.wait',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DistrCacheConnectAttempts': {
                    'name': 'cache.distributed.connection.attempts',
                    'type': 'monotonic_gauge',
                },
                'DistrCacheConnectMicroseconds': {
                    'name': 'cache.distributed.connection.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DistrCacheFallbackReadMicroseconds': {
                    'name': 'cache.distributed.fallback.read',
                    'type': 'monotonic_gauge',
                },
                'DistrCacheGetClient': {'name': 'cache.distributed.client_access', 'type': 'monotonic_gauge'},
                'DistrCacheGetResponseMicroseconds': {
                    'name': 'cache.distributed.response.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DistrCacheHoldConnections': {'name': 'cache.distributed.connections.used', 'type': 'monotonic_gauge'},
                'DistrCacheLockRegistryMicroseconds': {
                    'name': 'cache.distributed.registry_lock.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DistrCacheNextImplMicroseconds': {
                    'name': 'cache.distributed.read_buffer_next_impl.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DistrCacheOpenedConnections': {
                    'name': 'cache.distributed.connections.open',
                    'type': 'monotonic_gauge',
                },
                'DistrCachePackets': {'name': 'cache.distributed.packets.received', 'type': 'monotonic_gauge'},
                'DistrCachePrecomputeRangesMicroseconds': {
                    'name': 'cache.distributed.read.compute.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DistrCacheReadMicroseconds': {
                    'name': 'cache.distributed.read.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DistrCacheRegistryUpdateMicroseconds': {
                    'name': 'cache.distributed.registry.update.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DistrCacheRegistryUpdates': {'name': 'cache.distributed.registry.updates', 'type': 'monotonic_gauge'},
                'DistrCacheReusedConnections': {
                    'name': 'cache.distributed.connections.reused',
                    'type': 'monotonic_gauge',
                },
                'DistrCacheServerProcessRequestMicroseconds': {
                    'name': 'cache.distributed.server.requests.process_time',
                    'type': 'monotonic_gauge',
                },
                'DistrCacheServerSwitches': {'name': 'cache.distributed.server.switches', 'type': 'monotonic_gauge'},
                'DistrCacheStartRangeMicroseconds': {
                    'name': 'cache.distributed.new_read_range.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DistrCacheUnusedPackets': {'name': 'cache.distributed.packets.skipped', 'type': 'monotonic_gauge'},
                'DistrCacheUnusedPacketsBytes': {
                    'name': 'cache.distributed.packets.skipped.bytes',
                    'type': 'monotonic_gauge',
                },
                'DistributedAsyncInsertionFailures': {
                    'name': 'distributed.async.inserts.failed',
                    'type': 'monotonic_gauge',
                },
                'DistributedConnectionFailAtAll': {
                    'name': 'distributed.connection.fail_at_all',
                    'type': 'monotonic_gauge',
                },
                'DistributedConnectionFailTry': {'name': 'distributed.connection.fail_try', 'type': 'monotonic_gauge'},
                'DistributedConnectionMissingTable': {
                    'name': 'distributed.connection.missing_table',
                    'type': 'monotonic_gauge',
                },
                'DistributedConnectionStaleReplica': {
                    'name': 'distributed.connection.stale_replica',
                    'type': 'monotonic_gauge',
                },
                'DistributedConnectionTries': {'name': 'distributed.connection.tries', 'type': 'monotonic_gauge'},
                'DistributedConnectionUsable': {'name': 'distributed.connection.successful', 'type': 'monotonic_gauge'},
                'DistributedDelayedInserts': {'name': 'distributed.inserts.delayed', 'type': 'monotonic_gauge'},
                'DistributedDelayedInsertsMilliseconds': {
                    'name': 'distributed.delayed.inserts.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'DistributedRejectedInserts': {'name': 'distributed.inserts.rejected', 'type': 'monotonic_gauge'},
                'DistributedSyncInsertionTimeoutExceeded': {
                    'name': 'distributed.inserts.timeout',
                    'type': 'monotonic_gauge',
                },
                'DuplicatedInsertedBlocks': {
                    'name': 'table.mergetree.replicated.insert.deduplicate',
                    'type': 'monotonic_gauge',
                },
                'EngineFileLikeReadFiles': {'name': 'table_engines.files.read', 'type': 'monotonic_gauge'},
                'ExecuteShellCommand': {'name': 'shell_command.executions', 'type': 'monotonic_gauge'},
                'ExternalAggregationCompressedBytes': {
                    'name': 'memory.external.aggregation.bytes',
                    'type': 'monotonic_gauge',
                },
                'ExternalAggregationMerge': {
                    'name': 'memory.external.aggregation.files_merged',
                    'type': 'monotonic_gauge',
                },
                'ExternalAggregationUncompressedBytes': {
                    'name': 'memory.external.aggregation.uncompressed_bytes',
                    'type': 'monotonic_gauge',
                },
                'ExternalAggregationWritePart': {
                    'name': 'memory.external.aggregation.files.num_written',
                    'type': 'monotonic_gauge',
                },
                'ExternalDataSourceLocalCacheReadBytes': {
                    'name': 'cache.remote_read_buffer.read.bytes',
                    'type': 'monotonic_gauge',
                },
                'ExternalJoinCompressedBytes': {
                    'name': 'memory.external.join.compressed_bytes',
                    'type': 'monotonic_gauge',
                },
                'ExternalJoinMerge': {'name': 'memory.external.join.files.merged', 'type': 'monotonic_gauge'},
                'ExternalJoinUncompressedBytes': {
                    'name': 'memory.external.join.uncompressed_bytes',
                    'type': 'monotonic_gauge',
                },
                'ExternalJoinWritePart': {'name': 'memory.external.join.files.num_written', 'type': 'monotonic_gauge'},
                'ExternalProcessingCompressedBytesTotal': {
                    'name': 'processing.external.compressed.bytes',
                    'type': 'monotonic_gauge',
                },
                'ExternalProcessingFilesTotal': {'name': 'processing.external.files.total', 'type': 'monotonic_gauge'},
                'ExternalProcessingUncompressedBytesTotal': {
                    'name': 'processing.external.uncompressed.bytes',
                    'type': 'monotonic_gauge',
                },
                'ExternalSortCompressedBytes': {
                    'name': 'memory.external.sort.compressed_bytes',
                    'type': 'monotonic_gauge',
                },
                'ExternalSortMerge': {'name': 'memory.external.sort.files.num_written', 'type': 'monotonic_gauge'},
                'ExternalSortUncompressedBytes': {
                    'name': 'memory.external.sort.uncompressed_bytes',
                    'type': 'monotonic_gauge',
                },
                'ExternalSortWritePart': {'name': 'memory.external.sort.files.num_written', 'type': 'monotonic_gauge'},
                'FailedAsyncInsertQuery': {'name': 'query.async.insert.failed', 'type': 'monotonic_gauge'},
                'FailedInsertQuery': {'name': 'query.insert.failed', 'type': 'monotonic_gauge'},
                'FailedQuery': {'name': 'query.failed', 'type': 'monotonic_gauge'},
                'FailedSelectQuery': {'name': 'select.query.select.failed', 'type': 'monotonic_gauge'},
                'FileOpen': {'name': 'file.open', 'type': 'monotonic_gauge'},
                'FileSegmentCacheWriteMicroseconds': {
                    'name': 'file_segment.cache.write.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FileSegmentCompleteMicroseconds': {
                    'name': 'file_segment.cache.complete.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FileSegmentFailToIncreasePriority': {
                    'name': 'file_segment.cache.priority_increase.fail',
                    'type': 'monotonic_gauge',
                },
                'FileSegmentHolderCompleteMicroseconds': {
                    'name': 'file_segment.holder.complete.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FileSegmentLockMicroseconds': {
                    'name': 'file_segment.lock.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FileSegmentPredownloadMicroseconds': {
                    'name': 'file_segment.cache.predownload.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FileSegmentReadMicroseconds': {
                    'name': 'file_segment.read.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FileSegmentRemoveMicroseconds': {
                    'name': 'file_segment.remove.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FileSegmentUseMicroseconds': {
                    'name': 'file_segment.use.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FileSegmentUsedBytes': {'name': 'file_segment.use.bytes', 'type': 'monotonic_gauge'},
                'FileSegmentWaitMicroseconds': {'name': 'file_segment.download.wait_time', 'type': 'monotonic_gauge'},
                'FileSegmentWaitReadBufferMicroseconds': {
                    'name': 'file_segment.read.wait_time',
                    'type': 'monotonic_gauge',
                },
                'FileSegmentWriteMicroseconds': {'name': 'file_segment.write.timex', 'type': 'monotonic_gauge'},
                'FileSync': {'name': 'function.filesync', 'type': 'monotonic_gauge'},
                'FileSyncElapsedMicroseconds': {
                    'name': 'function.filesync.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FilesystemCacheEvictMicroseconds': {
                    'name': 'filesystem.cache.eviction.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FilesystemCacheEvictedBytes': {'name': 'filesystem.cache.eviction.bytes', 'type': 'monotonic_gauge'},
                'FilesystemCacheEvictedFileSegments': {
                    'name': 'filesystem.cache.eviction.file_segments',
                    'type': 'monotonic_gauge',
                },
                'FilesystemCacheEvictionSkippedFileSegments': {
                    'name': 'filesystem.cache.eviction.file_segments.skipped',
                    'type': 'monotonic_gauge',
                },
                'FilesystemCacheEvictionTries': {
                    'name': 'filesystem.cache.eviction.attempts',
                    'type': 'monotonic_gauge',
                },
                'FilesystemCacheFailToReserveSpaceBecauseOfLockContention': {
                    'name': 'filesystem.cache.lock.fail',
                    'type': 'monotonic_gauge',
                },
                'FilesystemCacheGetMicroseconds': {
                    'name': 'filesystem.cache.get.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FilesystemCacheGetOrSetMicroseconds': {
                    'name': 'filesystem.cache.get_set.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FilesystemCacheHoldFileSegments': {
                    'name': 'filesystem.cache.file_segments.held',
                    'type': 'monotonic_gauge',
                },
                'FilesystemCacheLoadMetadataMicroseconds': {
                    'name': 'filesystem.cache.metadata.load.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FilesystemCacheLockCacheMicroseconds': {
                    'name': 'filesystem.cache.lock.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FilesystemCacheLockKeyMicroseconds': {
                    'name': 'filesystem.cache.lock.key.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FilesystemCacheLockMetadataMicroseconds': {
                    'name': 'filesystem.cache.lock.metadata.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FilesystemCacheReserveMicroseconds': {
                    'name': 'filesystem.cache.reserve.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'FilesystemCacheUnusedHoldFileSegments': {
                    'name': 'filesystem.cache.file_segments.held.unused',
                    'type': 'monotonic_gauge',
                },
                'FunctionExecute': {'name': 'sql.ordinary.function.calls', 'type': 'monotonic_gauge'},
                'HTTPConnectionsCreated': {'name': 'connections.http.created', 'type': 'monotonic_gauge'},
                'HTTPConnectionsElapsedMicroseconds': {
                    'name': 'connections.http.created.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'HTTPConnectionsErrors': {'name': 'connections.http.failed', 'type': 'monotonic_gauge'},
                'HTTPConnectionsExpired': {'name': 'connections.http.expired', 'type': 'monotonic_gauge'},
                'HTTPConnectionsPreserved': {'name': 'connections.http.preserved', 'type': 'monotonic_gauge'},
                'HTTPConnectionsReset': {'name': 'connections.http.reset', 'type': 'monotonic_gauge'},
                'HTTPConnectionsReused': {'name': 'connections.http.reused', 'type': 'monotonic_gauge'},
                'HardPageFaults': {'name': 'threads.query.execution.hard_page_faults', 'type': 'monotonic_gauge'},
                'HedgedRequestsChangeReplica': {
                    'name': 'table.replica.change.hedged_requests',
                    'type': 'monotonic_gauge',
                },
                'IOBufferAllocBytes': {'name': 'io_buffer.allocated.bytes', 'type': 'monotonic_gauge'},
                'IOBufferAllocs': {'name': 'io_buffer.allocated', 'type': 'monotonic_gauge'},
                'IOUringCQEsCompleted': {'name': 'io_uring.cqe.completed', 'type': 'monotonic_gauge'},
                'IOUringCQEsFailed': {'name': 'io_uring.cqe.failed', 'type': 'monotonic_gauge'},
                'IOUringSQEsResubmits': {'name': 'io_uring.sqe.resubmitted', 'type': 'monotonic_gauge'},
                'IOUringSQEsSubmitted': {'name': 'io_uring.sqe.submitted', 'type': 'monotonic_gauge'},
                'IgnoredColdParts': {'name': 'queries.read.new_parts.ignored', 'type': 'monotonic_gauge'},
                'InitialQuery': {'name': 'query.initial', 'type': 'monotonic_gauge'},
                'InsertQueriesWithSubqueries': {'name': 'query.insert.subqueries', 'type': 'monotonic_gauge'},
                'InsertQuery': {'name': 'query.insert', 'type': 'monotonic_gauge'},
                'InsertQueryTimeMicroseconds': {
                    'name': 'insert.query.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'InsertedBytes': {'name': 'table.insert.size', 'type': 'monotonic_gauge'},
                'InsertedCompactParts': {'name': 'parts.compact.inserted', 'type': 'monotonic_gauge'},
                'InsertedRows': {'name': 'table.insert.row', 'type': 'monotonic_gauge'},
                'InsertedWideParts': {'name': 'parts.wide.inserted', 'type': 'monotonic_gauge'},
                'InterfaceHTTPReceiveBytes': {'name': 'interface.http.received.bytes', 'type': 'monotonic_gauge'},
                'InterfaceHTTPSendBytes': {'name': 'interface.http.sent.bytes', 'type': 'monotonic_gauge'},
                'InterfaceInterserverReceiveBytes': {
                    'name': 'interface.interserver.received.bytes',
                    'type': 'monotonic_gauge',
                },
                'InterfaceInterserverSendBytes': {
                    'name': 'interface.interserver.sent.bytes',
                    'type': 'monotonic_gauge',
                },
                'InterfaceMySQLReceiveBytes': {'name': 'interface.mysql.received.bytes', 'type': 'monotonic_gauge'},
                'InterfaceMySQLSendBytes': {'name': 'interface.mysql.sent.bytes', 'type': 'monotonic_gauge'},
                'InterfaceNativeReceiveBytes': {'name': 'interface.native.received.bytes', 'type': 'monotonic_gauge'},
                'InterfaceNativeSendBytes': {'name': 'interface.native.sent.bytes', 'type': 'monotonic_gauge'},
                'InterfacePostgreSQLReceiveBytes': {
                    'name': 'interface.postgresql.received.bytes',
                    'type': 'monotonic_gauge',
                },
                'InterfacePostgreSQLSendBytes': {'name': 'interface.postgresql.sent.bytes', 'type': 'monotonic_gauge'},
                'InterfacePrometheusReceiveBytes': {
                    'name': 'interface.prometheus.received.bytes',
                    'type': 'monotonic_gauge',
                },
                'InterfacePrometheusSendBytes': {'name': 'interface.prometheus.sent.bytes', 'type': 'monotonic_gauge'},
                'KafkaBackgroundReads': {'name': 'kafka.background.reads', 'type': 'monotonic_gauge'},
                'KafkaCommitFailures': {'name': 'kafka.commit.failed', 'type': 'monotonic_gauge'},
                'KafkaCommits': {'name': 'kafka.commit.success', 'type': 'monotonic_gauge'},
                'KafkaConsumerErrors': {'name': 'kafka.consumer.errors', 'type': 'monotonic_gauge'},
                'KafkaDirectReads': {'name': 'kafka.direct.read', 'type': 'monotonic_gauge'},
                'KafkaMessagesFailed': {'name': 'kafka.messages.failed', 'type': 'monotonic_gauge'},
                'KafkaMessagesPolled': {'name': 'kafka.messages.polled', 'type': 'monotonic_gauge'},
                'KafkaMessagesProduced': {'name': 'kafka.messages.produced', 'type': 'monotonic_gauge'},
                'KafkaMessagesRead': {'name': 'kafka.messages.read', 'type': 'monotonic_gauge'},
                'KafkaProducerErrors': {'name': 'kafka.producer.errors', 'type': 'monotonic_gauge'},
                'KafkaProducerFlushes': {'name': 'kafka.producer.flushes', 'type': 'monotonic_gauge'},
                'KafkaRebalanceAssignments': {'name': 'kafka.rebalance.assignments', 'type': 'monotonic_gauge'},
                'KafkaRebalanceErrors': {'name': 'kafka.rebalance.errors', 'type': 'monotonic_gauge'},
                'KafkaRebalanceRevocations': {'name': 'kafka.rebalance.revocations', 'type': 'monotonic_gauge'},
                'KafkaRowsRead': {'name': 'kafka.rows.read', 'type': 'monotonic_gauge'},
                'KafkaRowsRejected': {'name': 'kafka.rows.rejected', 'type': 'monotonic_gauge'},
                'KafkaRowsWritten': {'name': 'kafka.rows.written', 'type': 'monotonic_gauge'},
                'KafkaWrites': {'name': 'kafkta.table.writes', 'type': 'monotonic_gauge'},
                'KeeperCheckRequest': {'name': 'keeper.check.requests', 'type': 'monotonic_gauge'},
                'KeeperCommits': {'name': 'keeper.commits', 'type': 'monotonic_gauge'},
                'KeeperCommitsFailed': {'name': 'keeper.commits.failed', 'type': 'monotonic_gauge'},
                'KeeperCreateRequest': {'name': 'keeper.create.requests', 'type': 'monotonic_gauge'},
                'KeeperExistsRequest': {'name': 'keeper.exists.requests', 'type': 'monotonic_gauge'},
                'KeeperGetRequest': {'name': 'keeper.get.requests', 'type': 'monotonic_gauge'},
                'KeeperLatency': {'name': 'keeper.latency', 'type': 'monotonic_gauge'},
                'KeeperListRequest': {'name': 'keeper.list.requests', 'type': 'monotonic_gauge'},
                'KeeperLogsEntryReadFromCommitCache': {
                    'name': 'keeper.log_entry.commit_cache.read',
                    'type': 'monotonic_gauge',
                },
                'KeeperLogsEntryReadFromFile': {'name': 'keeper.log_entry.file.read', 'type': 'monotonic_gauge'},
                'KeeperLogsEntryReadFromLatestCache': {
                    'name': 'keeper.log_entry.latest_cache.read',
                    'type': 'monotonic_gauge',
                },
                'KeeperLogsPrefetchedEntries': {'name': 'keeper.log_entry.file.prefetched', 'type': 'monotonic_gauge'},
                'KeeperMultiReadRequest': {'name': 'keeper.multi_read.requests', 'type': 'monotonic_gauge'},
                'KeeperMultiRequest': {'name': 'keeper.multi.requests', 'type': 'monotonic_gauge'},
                'KeeperPacketsReceived': {'name': 'keeper.packets.received', 'type': 'monotonic_gauge'},
                'KeeperPacketsSent': {'name': 'keeper.packets.sent', 'type': 'monotonic_gauge'},
                'KeeperReadSnapshot': {'name': 'keeper.snapshot.read', 'type': 'monotonic_gauge'},
                'KeeperReconfigRequest': {'name': 'keeper.reconfig.requests', 'type': 'monotonic_gauge'},
                'KeeperRemoveRequest': {'name': 'keeper.remove.requests', 'type': 'monotonic_gauge'},
                'KeeperRequestTotal': {'name': 'keeper.requests.total', 'type': 'monotonic_gauge'},
                'KeeperSaveSnapshot': {'name': 'keeper.snapshot.save', 'type': 'monotonic_gauge'},
                'KeeperSetRequest': {'name': 'keeper.set.requests', 'type': 'monotonic_gauge'},
                'KeeperSnapshotApplys': {'name': 'keeper.snapshot.apply', 'type': 'monotonic_gauge'},
                'KeeperSnapshotApplysFailed': {'name': 'keeper.snapshot.apply.failed', 'type': 'monotonic_gauge'},
                'KeeperSnapshotCreations': {'name': 'keeper.snapshot.create', 'type': 'monotonic_gauge'},
                'KeeperSnapshotCreationsFailed': {'name': 'keerper.snapshot.create.failed', 'type': 'monotonic_gauge'},
                'LeaderElectionAcquiredLeadership': {
                    'name': 'table.mergetree.replicated.leader.elected',
                    'type': 'monotonic_gauge',
                },
                'LoadedMarksCount': {'name': 'marks.loaded.count', 'type': 'monotonic_gauge'},
                'LoadedMarksMemoryBytes': {'name': 'marks.loaded.bytes', 'type': 'monotonic_gauge'},
                'LocalReadThrottlerBytes': {'name': 'throttler.local_read.bytes', 'type': 'monotonic_gauge'},
                'LocalReadThrottlerSleepMicroseconds': {
                    'name': 'throttler.local_read.sleep.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'LocalWriteThrottlerBytes': {'name': 'throttler.local_write.bytes', 'type': 'monotonic_gauge'},
                'LocalWriteThrottlerSleepMicroseconds': {
                    'name': 'throttler.local_write.sleep.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'LogDebug': {'name': 'log.messages.debug', 'type': 'monotonic_gauge'},
                'LogError': {'name': 'log.messages.error', 'type': 'monotonic_gauge'},
                'LogFatal': {'name': 'log.messages.fatal', 'type': 'monotonic_gauge'},
                'LogInfo': {'name': 'log.messages.info', 'type': 'monotonic_gauge'},
                'LogTest': {'name': 'log.messages.test', 'type': 'monotonic_gauge'},
                'LogTrace': {'name': 'log.messages.trace', 'type': 'monotonic_gauge'},
                'LogWarning': {'name': 'log.messages.warning', 'type': 'monotonic_gauge'},
                'MMappedFileCacheHits': {'name': 'cache.mmap.file.found', 'type': 'monotonic_gauge'},
                'MMappedFileCacheMisses': {'name': 'cache.mmap.file.missed', 'type': 'monotonic_gauge'},
                'MainConfigLoads': {'name': 'configuration.main.reloaded', 'type': 'monotonic_gauge'},
                'MarkCacheHits': {'name': 'cache.mark.entry.found', 'type': 'monotonic_gauge'},
                'MarkCacheMisses': {'name': 'cache.mark.entry.missed', 'type': 'monotonic_gauge'},
                'MemoryAllocatorPurge': {'name': 'memory.allocator.purge', 'type': 'monotonic_gauge'},
                'MemoryAllocatorPurgeTimeMicroseconds': {
                    'name': 'memory.allocator.purge.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'MemoryOvercommitWaitTimeMicroseconds': {
                    'name': 'memory.allocator.purge.wait.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'Merge': {'name': 'merge', 'type': 'monotonic_gauge'},
                'MergeTreeAllRangesAnnouncementsSent': {
                    'name': 'table.mergetree.announcements.sent',
                    'type': 'monotonic_gauge',
                },
                'MergeTreeAllRangesAnnouncementsSentElapsedMicroseconds': {
                    'name': 'table.mergetree.announcements.sent.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'MergeTreeDataProjectionWriterBlocks': {
                    'name': 'table.mergetree.insert.block.projection',
                    'type': 'monotonic_gauge',
                },
                'MergeTreeDataProjectionWriterBlocksAlreadySorted': {
                    'name': 'table.mergetree.insert.block.already_sorted.projection',
                    'type': 'monotonic_gauge',
                },
                'MergeTreeDataProjectionWriterCompressedBytes': {
                    'name': 'table.mergetree.insert.block.size.compressed.projection',
                    'type': 'monotonic_gauge',
                },
                'MergeTreeDataProjectionWriterMergingBlocksMicroseconds': {
                    'name': 'table.mergetree.merging.projection.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'MergeTreeDataProjectionWriterRows': {
                    'name': 'table.mergetree.insert.write.row.projection',
                    'type': 'monotonic_gauge',
                },
                'MergeTreeDataProjectionWriterSortingBlocksMicroseconds': {
                    'name': 'table.mergetree.sorting.projection.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'MergeTreeDataProjectionWriterUncompressedBytes': {
                    'name': 'table.mergetree.insert.write.size.uncompressed.projection',
                    'type': 'monotonic_gauge',
                },
                'MergeTreeDataWriterBlocks': {'name': 'table.mergetree.insert.block', 'type': 'monotonic_gauge'},
                'MergeTreeDataWriterBlocksAlreadySorted': {
                    'name': 'table.mergetree.insert.block.already_sorted',
                    'type': 'monotonic_gauge',
                },
                'MergeTreeDataWriterCompressedBytes': {
                    'name': 'table.mergetree.insert.write.size.compressed',
                    'type': 'monotonic_gauge',
                },
                'MergeTreeDataWriterMergingBlocksMicroseconds': {
                    'name': 'table.mergetree.merging.blocks.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'MergeTreeDataWriterProjectionsCalculationMicroseconds': {
                    'name': 'table.mergetree.calculating.projections.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'MergeTreeDataWriterRows': {'name': 'table.mergetree.insert.row', 'type': 'monotonic_gauge'},
                'MergeTreeDataWriterSkipIndicesCalculationMicroseconds': {
                    'name': 'table.mergetree.calculating.skip_indices.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'MergeTreeDataWriterSortingBlocksMicroseconds': {
                    'name': 'table.mergetree.calculating.sorting.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'MergeTreeDataWriterStatisticsCalculationMicroseconds': {
                    'name': 'table.mergetree.calculating.statistics.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'MergeTreeDataWriterUncompressedBytes': {
                    'name': 'table.mergetree.insert.write.size.uncompressed',
                    'type': 'monotonic_gauge',
                },
                'MergeTreePrefetchedReadPoolInit': {
                    'name': 'table.mergetree.prefetched_read_pool.tasks.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'MergeTreeReadTaskRequestsReceived': {
                    'name': 'table.mergetree.read_task_requests.received',
                    'type': 'monotonic_gauge',
                },
                'MergeTreeReadTaskRequestsSent': {
                    'name': 'table.mergetree.read_task_requests.sent',
                    'type': 'monotonic_gauge',
                },
                'MergeTreeReadTaskRequestsSentElapsedMicroseconds': {
                    'name': 'table.mergetree.read_task_requests.sent.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'MergedIntoCompactParts': {'name': 'merge.parts.compact', 'type': 'monotonic_gauge'},
                'MergedIntoWideParts': {'name': 'merge.parts.wide', 'type': 'monotonic_gauge'},
                'MergedRows': {'name': 'merge.row.read', 'type': 'monotonic_gauge'},
                'MergedUncompressedBytes': {'name': 'merge.read.size.uncompressed', 'type': 'monotonic_gauge'},
                'MergesTimeMilliseconds': {'name': 'merge.time', 'type': 'temporal_percent', 'scale': 'millisecond'},
                'MetadataFromKeeperBackgroundCleanupErrors': {
                    'name': 'keeper.background.cleanup.errors',
                    'type': 'monotonic_gauge',
                },
                'MetadataFromKeeperBackgroundCleanupObjects': {
                    'name': 'keeper.background.cleanup.objects',
                    'type': 'monotonic_gauge',
                },
                'MetadataFromKeeperBackgroundCleanupTransactions': {
                    'name': 'keeper.background.cleanup.transactions',
                    'type': 'monotonic_gauge',
                },
                'MetadataFromKeeperCacheHit': {'name': 'keeper.cache.hit', 'type': 'monotonic_gauge'},
                'MetadataFromKeeperCacheMiss': {'name': 'keeper.cache.miss', 'type': 'monotonic_gauge'},
                'MetadataFromKeeperCacheUpdateMicroseconds': {
                    'name': 'keeper.cache.update.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'MetadataFromKeeperCleanupTransactionCommit': {
                    'name': 'keeper.cleanup.transaction.commit',
                    'type': 'monotonic_gauge',
                },
                'MetadataFromKeeperCleanupTransactionCommitRetry': {
                    'name': 'keeper.cleanup.transaction.commit.retry',
                    'type': 'monotonic_gauge',
                },
                'MetadataFromKeeperIndividualOperations': {
                    'name': 'keeper.individual.operations',
                    'type': 'monotonic_gauge',
                },
                'MetadataFromKeeperOperations': {'name': 'keeper.requests', 'type': 'monotonic_gauge'},
                'MetadataFromKeeperReconnects': {'name': 'keeper.reconnects', 'type': 'monotonic_gauge'},
                'MetadataFromKeeperTransactionCommit': {
                    'name': 'keeper.transactions.commit',
                    'type': 'monotonic_gauge',
                },
                'MetadataFromKeeperTransactionCommitRetry': {
                    'name': 'keeper.trasaction.commit.retry',
                    'type': 'monotonic_gauge',
                },
                'MetadataFromKeeperUpdateCacheOneLevel': {
                    'name': 'keeper.update.cache.one_level',
                    'type': 'monotonic_gauge',
                },
                'MutateTaskProjectionsCalculationMicroseconds': {
                    'name': 'task.mutate.calculate.projections.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'MutationsAppliedOnFlyInAllParts': {
                    'name': 'mutations.parts.applied.on_fly',
                    'type': 'monotonic_gauge',
                },
                'NetworkReceiveBytes': {'name': 'network.receive.size', 'type': 'monotonic_gauge'},
                'NetworkReceiveElapsedMicroseconds': {
                    'name': 'network.receive.elapsed.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'NetworkSendBytes': {'name': 'network.send.size', 'type': 'monotonic_gauge'},
                'NetworkSendElapsedMicroseconds': {
                    'name': 'network.send.elapsed.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'NotCreatedLogEntryForMerge': {'name': 'log.entry.merge.not_created', 'type': 'monotonic_gauge'},
                'NotCreatedLogEntryForMutation': {
                    'name': 'log.entry.mutation.not_created',
                    'type': 'monotonic_gauge',
                },
                'OSCPUVirtualTimeMicroseconds': {
                    'name': 'cpu.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'OSCPUWaitMicroseconds': {
                    'name': 'thread.cpu.wait',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'OSIOWaitMicroseconds': {'name': 'thread.io.wait', 'type': 'temporal_percent', 'scale': 'microsecond'},
                'OSReadBytes': {'name': 'disk.read.size', 'type': 'monotonic_gauge'},
                'OSReadChars': {'name': 'fs.read.size', 'type': 'monotonic_gauge'},
                'OSWriteBytes': {'name': 'disk.write.size', 'type': 'monotonic_gauge'},
                'OSWriteChars': {'name': 'fs.write.size', 'type': 'monotonic_gauge'},
                'ObsoleteReplicatedParts': {'name': 'data.part.replicated.obsolete', 'type': 'monotonic_gauge'},
                'OpenedFileCacheHits': {'name': 'cache.opened_file.hits', 'type': 'monotonic_gauge'},
                'OpenedFileCacheMicroseconds': {
                    'name': 'cache.opened_file.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'OpenedFileCacheMisses': {'name': 'cache.opened_file.misses', 'type': 'monotonic_gauge'},
                'OtherQueryTimeMicroseconds': {
                    'name': 'query.other.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'OverflowAny': {'name': 'query.overflow.any', 'type': 'monotonic_gauge'},
                'OverflowBreak': {'name': 'query.overflow.break', 'type': 'monotonic_gauge'},
                'OverflowThrow': {'name': 'query.overflow.throw', 'type': 'monotonic_gauge'},
                'PageCacheBytesUnpinnedRoundedToHugePages': {
                    'name': 'cache.page.unpinned.rounded_huge_pages.bytes',
                    'type': 'monotonic_gauge',
                },
                'PageCacheBytesUnpinnedRoundedToPages': {
                    'name': 'cache.page.unpinned.rounded_pages.bytes',
                    'type': 'monotonic_gauge',
                },
                'PageCacheChunkDataHits': {'name': 'cache.page.chunk.hits', 'type': 'monotonic_gauge'},
                'PageCacheChunkDataMisses': {'name': 'cache.page.chunk.evicted', 'type': 'monotonic_gauge'},
                'PageCacheChunkDataPartialHits': {'name': 'cache.page.chunk.hits.partial', 'type': 'monotonic_gauge'},
                'PageCacheChunkMisses': {'name': 'cache.page.chunk.misses', 'type': 'monotonic_gauge'},
                'PageCacheChunkShared': {'name': 'cache.page.chunk.shared', 'type': 'monotonic_gauge'},
                'ParallelReplicasAvailableCount': {'name': 'replicas.parralel.available', 'type': 'monotonic_gauge'},
                'ParallelReplicasCollectingOwnedSegmentsMicroseconds': {
                    'name': 'replicas.parralel.collect_segment.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ParallelReplicasDeniedRequests': {
                    'name': 'replicas.parralel.requests.denied',
                    'type': 'monotonic_gauge',
                },
                'ParallelReplicasHandleAnnouncementMicroseconds': {
                    'name': 'replicas.parralel.announcement.handle.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ParallelReplicasHandleRequestMicroseconds': {
                    'name': 'replicas.parralel.request.handle.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ParallelReplicasNumRequests': {'name': 'replicas.parralel.requests', 'type': 'monotonic_gauge'},
                'ParallelReplicasProcessingPartsMicroseconds': {
                    'name': 'replicas.parralel.processing.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ParallelReplicasReadAssignedForStealingMarks': {
                    'name': 'replicas.parralel.marks.stealing.assigned',
                    'type': 'monotonic_gauge',
                },
                'ParallelReplicasReadAssignedMarks': {
                    'name': 'replicas.parralel.marks.assigned',
                    'type': 'monotonic_gauge',
                },
                'ParallelReplicasReadUnassignedMarks': {
                    'name': 'replicas.parralel.marks.unassigned',
                    'type': 'monotonic_gauge',
                },
                'ParallelReplicasStealingByHashMicroseconds': {
                    'name': 'replicas.parralel.hash.stealing.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ParallelReplicasStealingLeftoversMicroseconds': {
                    'name': 'replicas.parralel.leftover_segment.stealing.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ParallelReplicasUnavailableCount': {
                    'name': 'replicas.parralel.unavailable',
                    'type': 'monotonic_gauge',
                },
                'ParallelReplicasUsedCount': {'name': 'replicas.parralel.used', 'type': 'monotonic_gauge'},
                'PartsLockHoldMicroseconds': {
                    'name': 'table.mergetree.partslock.hold.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'PartsLockWaitMicroseconds': {
                    'name': 'table.mergetree.partslock.wait.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'PartsWithAppliedMutationsOnFly': {'name': 'parts.mutations.applied.fly', 'type': 'monotonic_gauge'},
                'PerfAlignmentFaults': {'name': 'perf.alignment.faults', 'type': 'monotonic_gauge'},
                'PerfBranchInstructions': {'name': 'perf.branch.instructions', 'type': 'monotonic_gauge'},
                'PerfBranchMisses': {'name': 'perf.branch.misses', 'type': 'monotonic_gauge'},
                'PerfBusCycles': {'name': 'perf.bus.cycles', 'type': 'monotonic_gauge'},
                'PerfCPUClock': {'name': 'perf.cpu.clock', 'type': 'gauge'},
                'PerfCPUCycles': {'name': 'perf.cpu.cycles', 'type': 'monotonic_gauge'},
                'PerfCPUMigrations': {'name': 'perf.cpu.migrations', 'type': 'monotonic_gauge'},
                'PerfCacheMisses': {'name': 'perf.cache.misses', 'type': 'monotonic_gauge'},
                'PerfCacheReferences': {'name': 'perf.cache.references', 'type': 'monotonic_gauge'},
                'PerfContextSwitches': {'name': 'perf.context.switches', 'type': 'monotonic_gauge'},
                'PerfDataTLBMisses': {'name': 'perf.data.tlb.misses', 'type': 'monotonic_gauge'},
                'PerfDataTLBReferences': {'name': 'perf.data.tlb.references', 'type': 'monotonic_gauge'},
                'PerfEmulationFaults': {'name': 'perf.emulation.faults', 'type': 'monotonic_gauge'},
                'PerfInstructionTLBMisses': {'name': 'perf.instruction.tlb.misses', 'type': 'monotonic_gauge'},
                'PerfInstructionTLBReferences': {
                    'name': 'perf.instruction.tlb.references',
                    'type': 'monotonic_gauge',
                },
                'PerfInstructions': {'name': 'perf.instructions', 'type': 'monotonic_gauge'},
                'PerfLocalMemoryMisses': {'name': 'perf.local_memory.misses', 'type': 'monotonic_gauge'},
                'PerfLocalMemoryReferences': {'name': 'perf.local_memory.references', 'type': 'monotonic_gauge'},
                'PerfMinEnabledRunningTime': {
                    'name': 'perf.min_enabled.running_time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'PerfMinEnabledTime': {
                    'name': 'perf.min_enabled.min_time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'PerfRefCPUCycles': {'name': 'perf.cpu.ref_cycles', 'type': 'monotonic_gauge'},
                'PerfStalledCyclesBackend': {'name': 'perf.stalled_cycles.backend', 'type': 'monotonic_gauge'},
                'PerfStalledCyclesFrontend': {'name': 'perf.stalled_cycles.frontend', 'type': 'monotonic_gauge'},
                'PerfTaskClock': {'name': 'perf.task.clock', 'type': 'gauge'},
                'PolygonsAddedToPool': {'name': 'pool.polygon.added', 'type': 'monotonic_gauge'},
                'PolygonsInPoolAllocatedBytes': {'name': 'pool.polygon.bytes', 'type': 'monotonic_gauge'},
                'PreferredWarmedUnmergedParts': {'name': 'queries.read.outdated.parts', 'type': 'monotonic_gauge'},
                'QueriesWithSubqueries': {'name': 'query.subqueries', 'type': 'monotonic_gauge'},
                'Query': {'name': 'query', 'type': 'monotonic_gauge'},
                'QueryCacheHits': {'name': 'cache.query.hits', 'type': 'monotonic_gauge'},
                'QueryCacheMisses': {'name': 'cache.query.misses', 'type': 'monotonic_gauge'},
                'QueryMaskingRulesMatch': {'name': 'query.mask.match', 'type': 'monotonic_gauge'},
                'QueryMemoryLimitExceeded': {'name': 'query.memory.limit_exceeded', 'type': 'monotonic_gauge'},
                'QueryProfilerConcurrencyOverruns': {
                    'name': 'query.signal.dropped.overload',
                    'type': 'monotonic_gauge',
                },
                'QueryProfilerRuns': {'name': 'query.profiler.runs', 'type': 'monotonic_gauge'},
                'QueryProfilerSignalOverruns': {'name': 'query.signal.dropped', 'type': 'monotonic_gauge'},
                'QueryTimeMicroseconds': {'name': 'query.time', 'type': 'temporal_percent', 'scale': 'microsecond'},
                'RWLockAcquiredReadLocks': {'name': 'lock.read.rwlock.acquired', 'type': 'monotonic_gauge'},
                'RWLockAcquiredWriteLocks': {'name': 'lock.write.rwlock.acquired', 'type': 'monotonic_gauge'},
                'RWLockReadersWaitMilliseconds': {
                    'name': 'lock.read.rwlock.acquired.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'RWLockWritersWaitMilliseconds': {
                    'name': 'lock.write.rwlock.acquired.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ReadBackoff': {'name': 'query.read.backoff', 'type': 'monotonic_gauge'},
                'ReadBufferFromFileDescriptorRead': {'name': 'file.read', 'type': 'monotonic_gauge'},
                'ReadBufferFromFileDescriptorReadBytes': {'name': 'file.read.size', 'type': 'monotonic_gauge'},
                'ReadBufferFromFileDescriptorReadFailed': {'name': 'file.read.fail', 'type': 'monotonic_gauge'},
                'ReadBufferFromS3Bytes': {'name': 's3.read.size', 'type': 'monotonic_gauge'},
                'ReadBufferFromS3InitMicroseconds': {
                    'name': 's3.connect.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ReadBufferFromS3Microseconds': {
                    'name': 's3.read.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ReadBufferFromS3PreservedSessions': {'name': 's3.read.sessions.preserved.', 'type': 'monotonic_gauge'},
                'ReadBufferFromS3RequestsErrors': {'name': 's3.read.errors', 'type': 'monotonic_gauge'},
                'ReadBufferFromS3ResetSessions': {'name': 's3.read.reset', 'type': 'monotonic_gauge'},
                'ReadBufferSeekCancelConnection': {'name': 'read.connections.new', 'type': 'monotonic_gauge'},
                'ReadCompressedBytes': {'name': 'read.compressed.size', 'type': 'monotonic_gauge'},
                'ReadTaskRequestsReceived': {'name': 'task.read.requests.received', 'type': 'monotonic_gauge'},
                'ReadTaskRequestsSent': {'name': 'task.read.requests.sent', 'type': 'monotonic_gauge'},
                'ReadTaskRequestsSentElapsedMicroseconds': {
                    'name': 'task.read.requests.sent.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ReadWriteBufferFromHTTPPreservedSessions': {
                    'name': 'http.sessions.preserved',
                    'type': 'monotonic_gauge',
                },
                'RealTimeMicroseconds': {
                    'name': 'thread.process_time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'RegexpCreated': {'name': 'compilation.regex', 'type': 'monotonic_gauge'},
                'RejectedInserts': {'name': 'table.mergetree.insert.block.rejected', 'type': 'monotonic_gauge'},
                'RejectedMutations': {'name': 'table.mergetree.mutation.rejected', 'type': 'monotonic_gauge'},
                'RemoteFSBuffers': {'name': 'filesystem.remote.buffers', 'type': 'monotonic_gauge'},
                'RemoteFSCancelledPrefetches': {
                    'name': 'filesystem.remote.prefetches.cancelled',
                    'type': 'monotonic_gauge',
                },
                'RemoteFSLazySeeks': {'name': 'filesystem.remote.lazy_seeks', 'type': 'monotonic_gauge'},
                'RemoteFSPrefetchedBytes': {'name': 'filesystem.remote.prefetched.size', 'type': 'monotonic_gauge'},
                'RemoteFSPrefetchedReads': {'name': 'filesystem.remote.prefetched.reads', 'type': 'monotonic_gauge'},
                'RemoteFSPrefetches': {'name': 'filesystem.remote.aysnc.read.prefetches', 'type': 'monotonic_gauge'},
                'RemoteFSSeeks': {'name': 'filesystem.remote.buffer.seeks', 'type': 'monotonic_gauge'},
                'RemoteFSSeeksWithReset': {'name': 'filesystem.remote.buffer.seeks.reset', 'type': 'monotonic_gauge'},
                'RemoteFSUnprefetchedBytes': {'name': 'filesystem.remote.unprefetched.size', 'type': 'monotonic_gauge'},
                'RemoteFSUnprefetchedReads': {
                    'name': 'filesystem.remote.unprefetched.reads',
                    'type': 'monotonic_gauge',
                },
                'RemoteFSUnusedPrefetches': {'name': 'filesystem.remote.prefetches.pending', 'type': 'monotonic_gauge'},
                'RemoteReadThrottlerBytes': {'name': 'remote.read_throttler.bytes', 'type': 'monotonic_gauge'},
                'RemoteReadThrottlerSleepMicroseconds': {
                    'name': 'remote.query.read_throttler.sleep.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'RemoteWriteThrottlerBytes': {'name': 'remote.write_throttler.bytes', 'type': 'monotonic_gauge'},
                'RemoteWriteThrottlerSleepMicroseconds': {
                    'name': 'remote.query.write_throttler.sleep.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ReplicaPartialShutdown': {'name': 'table.replica.partial.shutdown', 'type': 'monotonic_gauge'},
                'ReplicaYieldLeadership': {'name': 'table.replicated.leader.yield', 'type': 'monotonic_gauge'},
                'ReplicatedCoveredPartsInZooKeeperOnStart': {'name': 'zk.parts.covered', 'type': 'monotonic_gauge'},
                'ReplicatedDataLoss': {'name': 'table.replicated.part.loss', 'type': 'monotonic_gauge'},
                'ReplicatedPartChecks': {'name': 'table.replicated.part.check', 'type': 'monotonic_gauge'},
                'ReplicatedPartChecksFailed': {'name': 'table.replicated.part.check.failed', 'type': 'monotonic_gauge'},
                'ReplicatedPartFailedFetches': {
                    'name': 'table.mergetree.replicated.fetch.replica.fail',
                    'type': 'monotonic_gauge',
                },
                'ReplicatedPartFetches': {
                    'name': 'table.mergetree.replicated.fetch.replica',
                    'type': 'monotonic_gauge',
                },
                'ReplicatedPartFetchesOfMerged': {
                    'name': 'table.mergetree.replicated.fetch.merged',
                    'type': 'monotonic_gauge',
                },
                'ReplicatedPartMerges': {'name': 'table.mergetree.replicated.merge', 'type': 'monotonic_gauge'},
                'ReplicatedPartMutations': {'name': 'table.mergetree.replicated.mutated', 'type': 'monotonic_gauge'},
                'S3AbortMultipartUpload': {'name': 's3.abort_multipart_upload', 'type': 'monotonic_gauge'},
                'S3Clients': {'name': 's3.clients.created', 'type': 'monotonic_gauge'},
                'S3CompleteMultipartUpload': {'name': 's3.complete_multipart_upload', 'type': 'monotonic_gauge'},
                'S3CopyObject': {'name': 's3.copy_object', 'type': 'monotonic_gauge'},
                'S3CreateMultipartUpload': {'name': 's3.create_multipart_upload', 'type': 'monotonic_gauge'},
                'S3DeleteObjects': {'name': 's3.delete_obkect', 'type': 'monotonic_gauge'},
                'S3GetObject': {'name': 's3.get_object', 'type': 'monotonic_gauge'},
                'S3GetObjectAttributes': {'name': 's3.get_object_attribute', 'type': 'monotonic_gauge'},
                'S3GetRequestThrottlerCount': {'name': 's3.get_request.throttled', 'type': 'monotonic_gauge'},
                'S3GetRequestThrottlerSleepMicroseconds': {
                    'name': 's3.get_request.throttled.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'S3HeadObject': {'name': 's3.head_object', 'type': 'monotonic_gauge'},
                'S3ListObjects': {'name': 's3.list_object', 'type': 'monotonic_gauge'},
                'S3PutObject': {'name': 's3.put_object', 'type': 'monotonic_gauge'},
                'S3PutRequestThrottlerCount': {'name': 's3.put_request.throttled', 'type': 'monotonic_gauge'},
                'S3PutRequestThrottlerSleepMicroseconds': {
                    'name': 's3.put_request.throttled.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'S3QueueCleanupMaxSetSizeOrTTLMicroseconds': {
                    'name': 's3.set_file.failed.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'S3QueueLockLocalFileStatusesMicroseconds': {
                    'name': 's3.lock_localfile_status.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'S3QueuePullMicroseconds': {
                    'name': 's3.read.file.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'S3QueueSetFileFailedMicroseconds': {
                    'name': 's3.set.file.failed.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'S3QueueSetFileProcessedMicroseconds': {
                    'name': 's3.set.file.processed.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'S3QueueSetFileProcessingMicroseconds': {
                    'name': 's3.set.file.processing.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'S3ReadBytes': {'name': 's3.read.bytes', 'type': 'monotonic_gauge'},
                'S3ReadMicroseconds': {'name': 's3.read.time', 'type': 'temporal_percent', 'scale': 'microsecond'},
                'S3ReadRequestsCount': {'name': 's3.read.requests', 'type': 'monotonic_gauge'},
                'S3ReadRequestsErrors': {'name': 's3.read.requests.errors', 'type': 'monotonic_gauge'},
                'S3ReadRequestsRedirects': {'name': 's3.read.requests.redirects', 'type': 'monotonic_gauge'},
                'S3ReadRequestsThrottling': {'name': 's3.read.requests.throttling', 'type': 'monotonic_gauge'},
                'S3UploadPart': {'name': 's3.upload_part', 'type': 'monotonic_gauge'},
                'S3UploadPartCopy': {'name': 's3.upload_part_copy', 'type': 'monotonic_gauge'},
                'S3WriteBytes': {'name': 's3.write.bytes', 'type': 'monotonic_gauge'},
                'S3WriteMicroseconds': {'name': 's3.write.time', 'type': 'temporal_percent', 'scale': 'microsecond'},
                'S3WriteRequestsCount': {'name': 's3.write.requests', 'type': 'monotonic_gauge'},
                'S3WriteRequestsErrors': {'name': 's3.write.requests.errors', 'type': 'monotonic_gauge'},
                'S3WriteRequestsRedirects': {'name': 's3.write.requests.redirects', 'type': 'monotonic_gauge'},
                'S3WriteRequestsThrottling': {'name': 's3.write.requests.throttling', 'type': 'monotonic_gauge'},
                'ScalarSubqueriesCacheMiss': {'name': 'subquery.scalar.read.cache.miss', 'type': 'monotonic_gauge'},
                'ScalarSubqueriesGlobalCacheHit': {
                    'name': 'subquery.scalar.read.cache.global',
                    'type': 'monotonic_gauge',
                },
                'ScalarSubqueriesLocalCacheHit': {
                    'name': 'subquery.scalar.read.cache.local',
                    'type': 'monotonic_gauge',
                },
                'SchemaInferenceCacheEvictions': {'name': 'cache.schema.evitcted', 'type': 'monotonic_gauge'},
                'SchemaInferenceCacheHits': {'name': 'cache.schema.found', 'type': 'monotonic_gauge'},
                'SchemaInferenceCacheInvalidations': {'name': 'cache.schema.invalid', 'type': 'monotonic_gauge'},
                'SchemaInferenceCacheMisses': {'name': 'cache.schema.missed', 'type': 'monotonic_gauge'},
                'SchemaInferenceCacheNumRowsHits': {'name': 'cache.schema.rows.found', 'type': 'monotonic_gauge'},
                'SchemaInferenceCacheNumRowsMisses': {'name': 'cache.schema.rows.missed', 'type': 'monotonic_gauge'},
                'SchemaInferenceCacheSchemaHits': {'name': 'cache.schema.found_schemas', 'type': 'monotonic_gauge'},
                'SchemaInferenceCacheSchemaMisses': {'name': 'cache.schema.missed_schemas', 'type': 'monotonic_gauge'},
                'Seek': {'name': 'file.seek', 'type': 'monotonic_gauge'},
                'SelectQueriesWithSubqueries': {'name': 'query.select.subqueries', 'type': 'monotonic_gauge'},
                'SelectQuery': {'name': 'query.select', 'type': 'monotonic_gauge'},
                'SelectQueryTimeMicroseconds': {
                    'name': 'query.select.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'SelectedBytes': {'name': 'selected.bytes', 'type': 'monotonic_gauge'},
                'SelectedMarks': {'name': 'table.mergetree.mark.selected', 'type': 'monotonic_gauge'},
                'SelectedParts': {'name': 'table.mergetree.part.selected', 'type': 'monotonic_gauge'},
                'SelectedRanges': {'name': 'table.mergetree.range.selected', 'type': 'monotonic_gauge'},
                'SelectedRows': {'name': 'selected.rows', 'type': 'monotonic_gauge'},
                'ServerStartupMilliseconds': {
                    'name': 'server.startup.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'SleepFunctionCalls': {'name': 'sleep_function.calls', 'type': 'monotonic_gauge'},
                'SleepFunctionElapsedMicroseconds': {
                    'name': 'sleep_function.sleep.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'SleepFunctionMicroseconds': {
                    'name': 'sleep_function.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'SlowRead': {'name': 'file.read.slow', 'type': 'monotonic_gauge'},
                'SoftPageFaults': {'name': 'threads.query.soft_page_faults', 'type': 'monotonic_gauge'},
                'StorageBufferErrorOnFlush': {'name': 'storage.buffer.flush_error', 'type': 'monotonic_gauge'},
                'StorageBufferFlush': {'name': 'storage.buffer.flush', 'type': 'monotonic_gauge'},
                'StorageBufferLayerLockReadersWaitMilliseconds': {
                    'name': 'storage.buffer_layer.read.wait',
                    'type': 'temporal_percent',
                    'scale': 'millisecond',
                },
                'StorageBufferLayerLockWritersWaitMilliseconds': {
                    'name': 'storage.buffer_layer.write.wait',
                    'type': 'temporal_percent',
                    'scale': 'millisecond',
                },
                'StorageBufferPassedAllMinThresholds': {
                    'name': 'storage.buffer.min_thresholds.passed',
                    'type': 'monotonic_gauge',
                },
                'StorageBufferPassedBytesFlushThreshold': {
                    'name': 'storage.buffer.passed_bytes.flush_threshold',
                    'type': 'monotonic_gauge',
                },
                'StorageBufferPassedBytesMaxThreshold': {
                    'name': 'storage.buffer.passed_bytes.max_threshold',
                    'type': 'monotonic_gauge',
                },
                'StorageBufferPassedRowsFlushThreshold': {
                    'name': 'storage.buffer.passed_rows.flush_threshold',
                    'type': 'monotonic_gauge',
                },
                'StorageBufferPassedRowsMaxThreshold': {
                    'name': 'storage.buffer.passed_rows.max_threshold',
                    'type': 'monotonic_gauge',
                },
                'StorageBufferPassedTimeFlushThreshold': {
                    'name': 'storage.buffer.passed_time.flush_threshold',
                    'type': 'monotonic_gauge',
                },
                'StorageBufferPassedTimeMaxThreshold': {
                    'name': 'storage.buffer.passed_time.max_threshold',
                    'type': 'monotonic_gauge',
                },
                'StorageConnectionsCreated': {'name': 'storage.connection.created', 'type': 'monotonic_gauge'},
                'StorageConnectionsElapsedMicroseconds': {
                    'name': 'storage.connection.created.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'StorageConnectionsErrors': {'name': 'storage.connection.create.error', 'type': 'monotonic_gauge'},
                'StorageConnectionsExpired': {'name': 'storage.connection.create.expired', 'type': 'monotonic_gauge'},
                'StorageConnectionsPreserved': {'name': 'storage.connection.preserved', 'type': 'monotonic_gauge'},
                'StorageConnectionsReset': {'name': 'storeage.connection.reset', 'type': 'monotonic_gauge'},
                'StorageConnectionsReused': {'name': 'storage.connection.reused', 'type': 'monotonic_gauge'},
                'SuspendSendingQueryToShard': {'name': 'shard.send_query.suspend', 'type': 'monotonic_gauge'},
                'SynchronousReadWaitMicroseconds': {
                    'name': 'read.synchronous.wait.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'SynchronousRemoteReadWaitMicroseconds': {
                    'name': 'remote.read.synchronous.wait.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'SystemTimeMicroseconds': {
                    'name': 'thread.system.process_time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'TableFunctionExecute': {'name': 'table.function', 'type': 'monotonic_gauge'},
                'ThreadPoolReaderPageCacheHit': {
                    'name': 'cache.page.thread_pool_reader.read',
                    'type': 'monotonic_gauge',
                },
                'ThreadPoolReaderPageCacheHitBytes': {
                    'name': 'cache.page.thread_pool_reader.read.size',
                    'type': 'monotonic_gauge',
                },
                'ThreadPoolReaderPageCacheHitElapsedMicroseconds': {
                    'name': 'cache.page.thread_pool_reader.read.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ThreadPoolReaderPageCacheMiss': {
                    'name': 'cache.page.thread_pool_reader.read.miss',
                    'type': 'monotonic_gauge',
                },
                'ThreadPoolReaderPageCacheMissBytes': {
                    'name': 'cache.page.thread_pool_reader.read.miss.size',
                    'type': 'monotonic_gauge',
                },
                'ThreadPoolReaderPageCacheMissElapsedMicroseconds': {
                    'name': 'cache.page.thread_pool_reader.read.miss.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ThreadpoolReaderPrepareMicroseconds': {
                    'name': 'cache.page.thread_pool_reader.prepare.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ThreadpoolReaderReadBytes': {'name': 'task.thread_pool_reader.read.size', 'type': 'monotonic_gauge'},
                'ThreadpoolReaderSubmit': {'name': 'task.thread_pool_reader.read', 'type': 'monotonic_gauge'},
                'ThreadpoolReaderSubmitLookupInCacheMicroseconds': {
                    'name': 'task.thread_pool_reader.cache.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ThreadpoolReaderSubmitReadSynchronously': {
                    'name': 'task.thread_pool_reader.read.sync',
                    'type': 'monotonic_gauge',
                },
                'ThreadpoolReaderSubmitReadSynchronouslyBytes': {
                    'name': 'task.thread_pool_reader.read.sync.size',
                    'type': 'monotonic_gauge',
                },
                'ThreadpoolReaderSubmitReadSynchronouslyMicroseconds': {
                    'name': 'task.thread_pool_reader.read.sync.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ThreadpoolReaderTaskMicroseconds': {
                    'name': 'task.thread_pool_reader.read.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ThrottlerSleepMicroseconds': {
                    'name': 'query.sleep.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'TinyS3Clients': {'name': 's3.client.copy.reuse', 'type': 'monotonic_gauge'},
                'USearchAddComputedDistances': {'name': 'index.usearch.distance.compute', 'type': 'monotonic_gauge'},
                'USearchAddCount': {'name': 'index.usearch.vector.add', 'type': 'monotonic_gauge'},
                'USearchAddVisitedMembers': {'name': 'index.usearch.vector.node.visit', 'type': 'monotonic_gauge'},
                'USearchSearchComputedDistances': {
                    'name': 'index.usearch.search.distance.compute',
                    'type': 'monotonic_gauge',
                },
                'USearchSearchCount': {'name': 'index.usearch.search.operation', 'type': 'monotonic_gauge'},
                'USearchSearchVisitedMembers': {'name': 'index.usearch.search.node.visit', 'type': 'monotonic_gauge'},
                'UncompressedCacheHits': {'name': 'cache.uncompressed.block_data', 'type': 'monotonic_gauge'},
                'UncompressedCacheMisses': {'name': 'cache.uncompressed.block_data.miss', 'type': 'monotonic_gauge'},
                'UncompressedCacheWeightLost': {
                    'name': 'cache.uncompressed.block_data.evicted',
                    'type': 'monotonic_gauge',
                },
                'UserTimeMicroseconds': {
                    'name': 'thread.user.process_time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'WaitMarksLoadMicroseconds': {
                    'name': 'marks.load.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'WaitPrefetchTaskMicroseconds': {
                    'name': 'task.prefetch.reader.wait.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'WriteBufferFromFileDescriptorWrite': {'name': 'file.write', 'type': 'monotonic_gauge'},
                'WriteBufferFromFileDescriptorWriteBytes': {'name': 'file.write.size', 'type': 'monotonic_gauge'},
                'WriteBufferFromFileDescriptorWriteFailed': {'name': 'file.write.fail', 'type': 'monotonic_gauge'},
                'WriteBufferFromS3Bytes': {'name': 's3.write.size', 'type': 'monotonic_gauge'},
                'WriteBufferFromS3Microseconds': {
                    'name': 's3.write.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'WriteBufferFromS3RequestsErrors': {'name': 's3.write.errors', 'type': 'monotonic_gauge'},
                'WriteBufferFromS3WaitInflightLimitMicroseconds': {
                    'name': 's3.write.wait.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ZooKeeperBytesReceived': {'name': 'zk.received.size', 'type': 'monotonic_gauge'},
                'ZooKeeperBytesSent': {'name': 'zk.sent.size', 'type': 'monotonic_gauge'},
                'ZooKeeperCheck': {'name': 'zk.check', 'type': 'monotonic_gauge'},
                'ZooKeeperClose': {'name': 'zk.close', 'type': 'monotonic_gauge'},
                'ZooKeeperCreate': {'name': 'zk.create', 'type': 'monotonic_gauge'},
                'ZooKeeperExists': {'name': 'zk.exist', 'type': 'monotonic_gauge'},
                'ZooKeeperGet': {'name': 'zk.get', 'type': 'monotonic_gauge'},
                'ZooKeeperHardwareExceptions': {'name': 'zk.network.exception', 'type': 'monotonic_gauge'},
                'ZooKeeperInit': {'name': 'zk.connection.established', 'type': 'monotonic_gauge'},
                'ZooKeeperList': {'name': 'zk.list', 'type': 'monotonic_gauge'},
                'ZooKeeperMulti': {'name': 'zk.multi', 'type': 'monotonic_gauge'},
                'ZooKeeperOtherExceptions': {'name': 'zk.other.exception', 'type': 'monotonic_gauge'},
                'ZooKeeperReconfig': {'name': 'zk.reconfig', 'type': 'monotonic_gauge'},
                'ZooKeeperRemove': {'name': 'zk.remove', 'type': 'monotonic_gauge'},
                'ZooKeeperSet': {'name': 'zk.set', 'type': 'monotonic_gauge'},
                'ZooKeeperSync': {'name': 'zk.sync', 'type': 'monotonic_gauge'},
                'ZooKeeperTransactions': {'name': 'zk.operation', 'type': 'monotonic_gauge'},
                'ZooKeeperUserExceptions': {'name': 'zk.data.exception', 'type': 'monotonic_gauge'},
                'ZooKeeperWaitMicroseconds': {
                    'name': 'zk.wait.time',
                    'type': 'temporal_percent',
                    'scale': 'microsecond',
                },
                'ZooKeeperWatchResponse': {'name': 'zk.watch', 'type': 'monotonic_gauge'},
            },
        },
    ],
}


# https://clickhouse.yandex/docs/en/operations/system_tables/#system_tables-asynchronous_metrics
SystemAsynchronousMetrics = {
    'name': 'system.asynchronous_metrics',
    'query': 'SELECT value, metric FROM system.asynchronous_metrics',
    'columns': [
        {'name': 'value', 'type': 'source'},
        {
            'name': 'metric',
            'type': 'match',
            'source': 'value',
            'items': {
                'CompiledExpressionCacheCount': {'name': 'CompiledExpressionCacheCount', 'type': 'gauge'},
                'MarkCacheBytes': {'name': 'table.mergetree.storage.mark.cache', 'type': 'gauge'},
                'MarkCacheFiles': {'name': 'MarkCacheFiles', 'type': 'gauge'},
                'MaxPartCountForPartition': {'name': 'part.max', 'type': 'gauge'},
                'NumberOfDatabases': {'name': 'database.total', 'type': 'gauge'},
                'NumberOfTables': {'name': 'table.total', 'type': 'gauge'},
                'ReplicasMaxAbsoluteDelay': {'name': 'replica.delay.absolute', 'type': 'gauge'},
                'ReplicasMaxInsertsInQueue': {'name': 'ReplicasMaxInsertsInQueue', 'type': 'gauge'},
                'ReplicasMaxMergesInQueue': {'name': 'ReplicasMaxMergesInQueue', 'type': 'gauge'},
                'ReplicasMaxQueueSize': {'name': 'ReplicasMaxQueueSize', 'type': 'gauge'},
                'ReplicasMaxRelativeDelay': {'name': 'replica.delay.relative', 'type': 'gauge'},
                'ReplicasSumInsertsInQueue': {'name': 'ReplicasSumInsertsInQueue', 'type': 'gauge'},
                'ReplicasSumMergesInQueue': {'name': 'ReplicasSumMergesInQueue', 'type': 'gauge'},
                'ReplicasSumQueueSize': {'name': 'replica.queue.size', 'type': 'gauge'},
                'UncompressedCacheBytes': {'name': 'UncompressedCacheBytes', 'type': 'gauge'},
                'UncompressedCacheCells': {'name': 'UncompressedCacheCells', 'type': 'gauge'},
                'Uptime': {'name': 'uptime', 'type': 'gauge'},
                'jemalloc.active': {'name': 'jemalloc.active', 'type': 'gauge'},
                'jemalloc.allocated': {'name': 'jemalloc.allocated', 'type': 'gauge'},
                'jemalloc.background_thread.num_runs': {
                    'name': 'jemalloc.background_thread.num_runs',
                    'type': 'gauge',
                },
                'jemalloc.background_thread.num_threads': {
                    'name': 'jemalloc.background_thread.num_threads',
                    'type': 'gauge',
                },
                'jemalloc.background_thread.run_interval': {
                    'name': 'jemalloc.background_thread.run_interval',
                    'type': 'gauge',
                },
                'jemalloc.mapped': {'name': 'jemalloc.mapped', 'type': 'gauge'},
                'jemalloc.metadata': {'name': 'jemalloc.metadata', 'type': 'gauge'},
                'jemalloc.metadata_thp': {'name': 'jemalloc.metadata_thp', 'type': 'gauge'},
                'jemalloc.resident': {'name': 'jemalloc.resident', 'type': 'gauge'},
                'jemalloc.retained': {'name': 'jemalloc.retained', 'type': 'gauge'},
            },
        },
    ],
}


# https://clickhouse.yandex/docs/en/operations/system_tables/#system_tables-parts
SystemParts = {
    'name': 'system.parts',
    'query': compact_query(
        """
            SELECT
              database,
              table,
              sum(bytes_on_disk) AS bytes,
              count() AS parts,
              sum(rows) AS rows
            FROM system.parts
            WHERE active = 1
            GROUP BY
              database,
              table
            """
    ),
    'columns': [
        {'name': 'database', 'type': 'tag'},
        {'name': 'table', 'type': 'tag'},
        {'name': 'table.mergetree.size', 'type': 'gauge'},
        {'name': 'table.mergetree.part.current', 'type': 'gauge'},
        {'name': 'table.mergetree.row.current', 'type': 'gauge'},
    ],
}


# https://clickhouse.yandex/docs/en/operations/system_tables/#system_tables-replicas
SystemReplicas = {
    'name': 'system.replicas',
    'query': compact_query(
        """
            SELECT
              database,
              table,
              is_leader,
              is_readonly,
              is_session_expired,
              future_parts,
              parts_to_check,
              columns_version,
              queue_size,
              inserts_in_queue,
              merges_in_queue,
              log_max_index,
              log_pointer,
              total_replicas,
              active_replicas
            FROM system.replicas
            """
    ),
    'columns': [
        {'name': 'database', 'type': 'tag'},
        {'name': 'table', 'type': 'tag'},
        {'name': 'is_leader', 'type': 'tag', 'boolean': True},
        {'name': 'is_readonly', 'type': 'tag', 'boolean': True},
        {'name': 'is_session_expired', 'type': 'tag', 'boolean': True},
        {'name': 'table.replicated.part.future', 'type': 'gauge'},
        {'name': 'table.replicated.part.suspect', 'type': 'gauge'},
        {'name': 'table.replicated.version', 'type': 'gauge'},
        {'name': 'table.replicated.queue.size', 'type': 'gauge'},
        {'name': 'table.replicated.queue.insert', 'type': 'gauge'},
        {'name': 'table.replicated.queue.merge', 'type': 'gauge'},
        {'name': 'table.replicated.log.max', 'type': 'gauge'},
        {'name': 'table.replicated.log.pointer', 'type': 'gauge'},
        {'name': 'table.replicated.total', 'type': 'gauge'},
        {'name': 'table.replicated.active', 'type': 'gauge'},
    ],
}


# https://clickhouse.yandex/docs/en/operations/system_tables/#system-dictionaries
SystemDictionaries = {
    'name': 'system.dictionaries',
    'query': compact_query(
        """
            SELECT
              name,
              bytes_allocated,
              element_count,
              load_factor
            FROM system.dictionaries
            """
    ),
    'columns': [
        {'name': 'dictionary', 'type': 'tag'},
        {'name': 'dictionary.memory.used', 'type': 'gauge'},
        {'name': 'dictionary.item.current', 'type': 'gauge'},
        {'name': 'dictionary.load', 'type': 'gauge'},
    ],
}
